$ (document). Ready (function(){ $('. Uninstall_list_checkbox '). Click (function(){ if($( This). Parent ('. Uninstall_list '). Children (' input '). attr ("checked") = =true) {//To determine whether to select the $ ( This). Parent ('. Uninstall_list '). Children (' input '). attr (' checked '),false); Settings not selected}Else { $( This). Parent ('. Uninstall_list '). Children (' input '). attr (' checked '),true); } /*if (!$ (this). Hasclass ("checked")) {//Determine if there is a class of checked $ (this). AddClass ("checked"); Add Class $ (this). Parent ('. Uninstall_list '). Children (' input '). attr (' checked ', true); Set check box to select} else {$ (this). Removeclass ("checked"); $ (this). Parent ('. Uninstall_list '). Children (' input '). attr (' checked ', false); }*/ });});
This method is also used to determine whether a checkbox is selected:
if ($ (this). Parent ('. Uninstall_list '). Children (' input '). Is (": checked"));
The setting is: $ (this). Parent ('. Uninstall_list '). Children (' input '). attr (' checked ', false);
When you refresh, jquery gets whether the checkbox is checked and set