From the course: Creating Surveys with HTML5
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Returning multiple checkbox values
From the course: Creating Surveys with HTML5
Returning multiple checkbox values
We're going to finish up the job of getting the user answers in this lesson. And we'll get a jump on populating the review table for the remaining two questions. We'll be using jQuery routines to loop through the checkbox values in questions one and five. So I've got survey.htm from the Chapter 4, 04_02 folder open now in my code editor. And I'm going to put the new code in my existing document.ready function that you see starting on line 21. Let's scroll down a tad so you can put that front and center. (SOUND) So we want this routine to fire whenever the button with the review ID is clicked. So I'll put in $('#review'). That's my review ID, and then .click(function() and then {}. Now we can add in the code to get the values from question one, which courses are you interested in? We'll set up a variable called interests checked, as in what interests did you check. And we'll set that = $('.interests:checked'). Now you may recall that each of the radio buttons has a class of interests…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.