About the checkbox When I was making a checkbox yesterday, I thought it should be quite simple at first. I took it for granted that the main function is to click a button, such as selecting all This is a function, and then all the following lists are selected for the effect.
Later, I still encountered a lot of problems in practice. Note that in the input checkbox, it is not possible to use the ordinary attr attribute to judge, because the value of checked is checked, and only the prop attribute can be used. Change! ! ! ! See the api documentation, and later found out in Baidu that this has been explained in the official api. Attached is the api address of a prop in jquery http://api.jquery.com/prop/, one of which is a classic example , comparing attr and prop by judging is(":checked"), it is worth taking a look. The code was changed later;
$("#main-manage").on('click',"#selectAll", function(event) {
$("#xunTable"). find('input').not(":disabled").each(function(index, el) {
if($("#selectAll").is(":checked")){
$ (this).prop('checked', 'true');
}
else{
$(this).prop('checked', 'false');
$(this) .removeAttr('checked');
}
});
});