In jQuery, checkbox repeatedly calls attr ('checked', true/false). Only the solution that takes effect for the first time is jqueryattr.
The example in this article describes how checkbox repeatedly calls attr ('checked', true/false) in jQuery to only take effect for the first time. We will share this with you for your reference. The details are as follows:
First look at the following code:
/*** Select all */function checkAll () {$ ("input [name = ids]"). attr ("checked", true);}/*** do not select all */function uncheckAll () {$ ("input [name = ids]"). attr ("checked", false );}
Problem description:
The check boxes in the initial status are not all selected. Click the Select All button to call the checkAll method to select all. Then, click the Select All button to select all options. Then, click the Select All button again, but the results are all selected, repeatedly clicking the wood has any reaction.
Solution:
Google:
Replace the attr method with the prop method,
/*** Select all */function checkAll () {$ ("input [name = ids]"). prop ("checked", true );}
Now the problem is solved!