jquery filter .not()
- by FFish
I have a form with image thumbnails to select with checkboxes for downloading.
I want an array with the images in jQuery for an Ajax call.
2 questions:
- On the top of the table there is a checkbox to toggle all checkboxes that I want to exclude from the mapping. I had a look at jQuery's .not() but I can't implement it with the :checkbox selector
- is the following example code correct?
$(document).ready(function() {
$('#myform').submit(function() {
var images = $("input:checkbox", this).map(function() {
return $(this).attr("name");
}).get().join();
alert(products); // outputs: ",check1,check2,check3"
return false; // cancel submit action by returning false
});
}); // end doc ready
HTML:
<form id="myform" action="" >
<input type="checkbox" id="toggleCheck" onclick="toggleSelectAll()" checked="checked" ><br />
<input type="checkbox" name="001.jpg" checked="checked" /><br />
<input type="checkbox" name="002.jpg" checked="checked" /><br />
<input type="checkbox" name="003.jpg" checked="checked" /><br />
<br />
<input type="submit" value="download" >
</form>