1. Get a single checkbox check (three notation) $ ("input:checkbox:checked"). Val () or $ ("input:[type= ' checkbox ']:checked"). Val (); or $ ("input:[name= ' ck ']:checked"). Val ();
2. Get multiple checkboxes checked items $ (' Input:checkbox '). each (function () {if ($ (). attr (' checked ') ==true) { Alert (This). Val ()); } });
3. Set the first checkbox to a check value of $ (' Input:checkbox:first '). attr ("Checked", ' checked '); or $ (' Input:checkbox '). EQ (0). attr ("Checked", ' true ');
4. Set the last checkbox to the check value $ (' input:radio:last '). attr (' checked ', ' checked '); or $ (' input:radio:last '). attr (' checked ', ' true ');
5. Set any checkbox according to the index value to the check value $ (' Input:checkbox). EQ (index value). attr (' checked ', ' true '); index value =0,1,2 .... or $ (' Input:radio '). Slice. attr (' checked ', ' true ');
6. Select multiple checkboxes to select the checkbox $ (' Input:radio ') for both 1th and 2nd. Slice (0,2). attr (' checked ', ' true ');
7. Set the checkbox to the value value $ ("input:checkbox[value= ' 1"). attr (' checked ', ' true ');
8. Delete the Value=1 checkbox $ ("input:checkbox[value= ' 1 ')". Remove ();
9. Delete the first few checkboxes $ ("Input:checkbox"). EQ (index value). Remove (); index value =0,1,2 .... Delete the 3rd checkbox: $ ("Input:checkbox"). EQ (2). Remove ();
10. Traverse checkbox $ (' Input:checkbox '). each (function (index, Domele) {//write code});
11. Select All $ (' Input:checkbox '). each (function () {$ (this). attr (' checked ', true);});
12. Deselect all $ (' Input:checkbox '). each (function () {$ (this). attr (' checked ', false);});
Html+css+js