Introduction to jquery traversal checkbox
- 2020-03-30 02:04:11
- OfStack
Cancel all checkbox selections
$(" # ChkAll "). Click (function () {
$(" # divContent input [type = 'checkbox'] "). The attr (" checked ", $(this). Attr (" checked "));
});
Gets the value of the checkbox selected:
Var arrChk = $(" input [name = 'chk_list'] [checked] ");
$(arrChk). Each (function () {
Window. Alert (enclosing value);
});
});
$(" # checkbox_id "). Attr (" checked "); // gets the status of a CheckBox (whether checked or not, returns true/false)
$(" # checkbox_id "). Attr (" checked ", true); // set the state of a CheckBox to checked=true