Home>Article>Web Front-end> How to implement jquery checkbox if it is not optional

How to implement jquery checkbox if it is not optional

藏色散人
藏色散人 Original
2021-02-07 10:38:35 4364browse

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.

How to implement jquery checkbox if it is not optional

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn