I have a form with thumbnails of images for selection using checkboxes for upload. I want an image array in jQuery to call Ajax.
2 questions:
- At the top of the table there is a flag for switching all the flags that I want to exclude from the comparison. I looked at jQuery.not (), but I cannot implement it with: checkbox selector
- correct example code?
$(document).ready(function() {
$('#myform').submit(function() {
var images = $("input:checkbox", this).map(function() {
return $(this).attr("name");
}).get().join();
alert(images);
return false;
});
});
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>
Ffish source
share