I'm New in Jquery. i Have this kind of checkbox array
<input type="checkbox" name="propertyfeatures[Appliances]" value="Dishwasher">
<input type="checkbox" name="propertyfeatures[Appliances]" value="Dryer" >
<input type="checkbox" name="propertyfeatures[Appliances]" value="Freezer">
<input type="checkbox" name="propertyfeatures[Appliances]" value="Garbage disposal" >
<input type="checkbox" name="propertyfeatures[Appliances]" value="Microwave">
<input type="checkbox" name="propertyfeatures[Appliances]" value="Range / Oven" >
<input type="checkbox" name="propertyfeatures[Appliances]" value="Refrigerator">
<input type="checkbox" name="propertyfeatures[Appliances]" value="Trash compactor" >
<input type="checkbox" name="propertyfeatures[Appliances]" value="Washer">
<input type="checkbox" name="propertyfeatures[Appliances]" value="None" >
How i will get all Appliances array value in jquery when None Checkbox is Checked
JSFiddle:
Give None
checkbox an ID
for example save_value
:
<input type="checkbox" name="propertyfeatures[Appliances]" value="None" id="save_value">
$(function(){
$('#save_value').click(function(){
var val = [];
$(':checkbox:checked').each(function(i){
val[i] = $(this).val();
alert(val[i]);
});
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.