如何在javascript中使复选框只读? [英] How to make checkbox readonly in javascript?
问题描述
我想点击一个复选框,然后复选框将被检查,如果我再次点击不会取消选中的复选框,如果我按一个按钮并单击该复选框可以取消选中的按钮
我尝试过:
HTML>
< HEAD>
< SCRIPT>
函数readOnlyCheckBox(){
返回false;
}
< / SCRIPT>
< BODY>
< input type =checkboxid =cbx1
` / > readonly
< input type =checkboxid =cbx2
CHECKED DISABLED />已停用
< / BODY>
< / HTML>
i want to click a checkbox then the checkbox will be checked if i click again to checkbox that will not be unchecked and if i take a button and click the button that checkbox can be unchecked
What I have tried:
HTML>
<HEAD>
<SCRIPT>
function readOnlyCheckBox() {
return false;
}
</SCRIPT>
<BODY>
<input type="checkbox" id="cbx1"
` /> readonly
<input type="checkbox" id="cbx2"
CHECKED DISABLED/> disabled
</BODY>
</HTML>
推荐答案
您好,朋友试试这个JQuery
Hello, Friend try this JQuery
(文件).ready(function(){
if(
(document).ready(function(){
if(
('#s:checked')。length){
('#s:checked').length){
这篇关于如何在javascript中使复选框只读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!