JQuery cannot set the checkbox check box selection cause resolution, jquerycheckbox
Why does jQuery fail to set the checkbox check box:
Many coders may encounter this strange situation, that is, they use jQuery to set the checkbox to an invalid status, even though the Code has no errors, the following describes why this problem occurs and how to solve it. We hope to help our friends who need it.
Let's first look at a code example:
<! DOCTYPE html>
In the above Code, when you select all for the first time and then cancel all the selections, then click "select all" again, this will not work, and there will be no problem before jQuery1.9, there is no problem in IE8 and IE8 browsers. To solve this problem, modify the Code as follows:
<! DOCTYPE html>
You only need to change the attr () function to the prop () function. The main reason is the difference between element property and attribute.
Related reading:
1. For details about property and attribute attributes, refer to the introduction section of js property and attribute attributes.
2. For browser compatibility issues, see section 1 about Attribue attribute compatibility of js.
The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 13046.
For more information, see: http://www.softwhy.com/jquery/