Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with an Array

Featured Replies

I'm currently developing an interactive part of my website and am have some real difficulty with my array. I currently have over 2000 questions, but have restricted the loop to just 50 at a time.

 

xml.find("question").each(function(){
	        		var q = $(this);
	        		number++;
	        		//console.log(q.contents().find("media").text());
	        		var question = new Question({
	        			question:q.contents().first().text(),
	        			image:q.find("media").text(),
	        			prefix: prefix,
	        			number: number,
	        			fixHeightListener: fixWrapperHeight,
	        			questionListener: questionListener,
	        			singlechoicehint: singlechoicehint,
	        			multiplechoicehint: multiplechoicehint,
	        			showHint: showHint
	        		});
	        		question.createAnswers(q.children("answer"));
	        		questions.push(question);
if(number == 50) return false
	        	});
	        	//console.log("loaded");
	        	// go( questionId);
	        } // end success ajax
	    }); // end ajax

this is the section of code that i'm using, but I want to add a random function in to the loop.

 

I've tried various ways, all of which have been unsuccessful

 

can anyone help

 

Thanks

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.