The jquery decision check box is checked and how to select the question to do a summary.
To get to the point, or when the page is like the next set of check boxes:
<input type= "checkbox" name= "fruit" value= "apple"/> Apples <input
type= "checkbox" name= "fruit" value= "orange "/> Orange
<input type=" checkbox "name=" fruit "value=" banana "/> Banana
<input type=" checkbox "Name=" fruit "Value=" Grape "/> Grapes
Then use Jquery to get the values of a set of checkboxes for Name=fruit as follows:
var checkval= ';
$ ("Input[name= ' fruit ']:checkbox"). each (the function () {
if ($ (this). attr (' checked ')) {
checkval+=$ (.). Val ( )+',';
}
})
Determine if the check box for the Name=fruit group has the selected option:
var flag=false;
$ ("Input[name= ' fruit ']:checkbox"). each (function () {
if ($ (this). attr (' checked ')) {
flag=true;
}
})
if (flag) {
alert (' has been selected ');
} else{
alert (' No options selected ');
}
The above is the jquery check box is selected method, I hope to learn some help, but also useful JS get, please refer to the "JS Judge check box is selected instance"