Home > Article > Web Front-end > How to uncheck checkbox in jquery?
Method: First select the checkbox element, and then use the prop() or attr() method to set the checked attribute value of the element to false, for example "$("input[type=' checkbox']").prop("checked",false);".
Related recommendations: "jQuery Tutorial"
The operating environment of this tutorial: windows7 system, jquery3.5 version, this method is applicable For all brands of computers.
Jquery method to uncheck checkbox:
1. Use prop() method
//设置不选中: $("input[type='checkbox']").prop("checked",false); //设置选中: $("input[type='checkbox']").prop("checked",true);
2. Use attr() method
//设置不选中: $("input[type='checkbox']").attr("checked",false); //设置选中: $("input[type='checkbox']").attr("checked",true);
For more programming-related knowledge, please visit: Programming Course! !
The above is the detailed content of How to uncheck checkbox in jquery?. For more information, please follow other related articles on the PHP Chinese website!