How to implement jquery checkbox as non-optional: First create a code sample file; then set the checkbox as non-optional through the "$(this).attr("disabled", false);" statement.
The operating environment of this article: Windows7 system, jquery1.2.6, Dell G3 computer.
How to make checkbox unselectable in jquery?
In jquery, if you want the checkbox to be unselectable, you need to disable the checkbox (checkbox) and add the disabled attribute to the checkbox.
Example:
$("input[type=checkbox]").each(function () { $(this).attr("disabled", false); });
How to enable the disabled checkbox?
JQuery disables or starts the checkbox code
function changeCheckboxState(lx){ if(true){//禁用 $("input[type=checkbox]").each(function(){ $(this).attr("disabled",true); }); }else{//启用 $("input[type=checkbox]").each(function(){ $(this).attr("disabled",false); }); } }
Recommended: "jquery video tutorial"
The above is the detailed content of How to implement jquery checkbox if it is not optional. For more information, please follow other related articles on the PHP Chinese website!