I have check boxes inside a form (id='submit_slides_1'):
After submitting the form I want to fetch all of the values of the checked checkboxes:
<input type='checkbox' class='chk_selection_info_box' name='thumb_selection[]' value='" + images[i]['url'] + "'>
and in my javascript I have the following code:
$("#submit_slides_1").submit(function(e) {
e.preventDefault();
var x=$("#thumb_selection").is(":checked");
alert(x);
}
);
But it keeps giving me False; Am I missing something?
ADDED: Tried but it says "undefined" too:
$(".chk_selection_info_box:checked").each(function(i,l)
{
alert(l.value);
});
If you need more clarification, please let me know which part you need more clarification!
Thanks
formhas thenameof'submit_slides_1', but you're selecting theformwith theidof"#submit_slides_1". This is obvious, but not necessarily correct; please: show your HTML, don't describe it at us.$('[name="thumb_selection[]"]:checked').map(function(){return this.value});will return the array of values of the checked check boxes.is()returns a boolean representing whether the condition is true or false. Move the:checkedpseudo class to your selector$('#thumb_selection:checked')