javascript - 想要禁用选中的复选框
问题描述
我想禁用 user1 选择的复选框,这样如果另一个用户登录该页面,他应该无法对选定的复选框进行任何更改。这有点像餐厅餐桌预订系统
<?php
$st = "select * from seat where hotel='$test'";
$q= mysqli_query($conn,$st);
$tester = mysqli_fetch_array($q);
$tab = $tester['two'];
?>
<form method="post">
<input type="submit" name="bookbtn" value="Book Your table">
<div id="mask2"style="float:left;width:20%;">
<?php $i=1;
while ($i<=$tab)
{?>
<div class="TWO">
<div class="check"style="height:40px;width:120px;">
<div class="seconda">
</div>
<div class="secondb">
<input type ="checkbox"name="checky[]"
style="width:30px;height:30px;"
value="<?php echo "two".$i;?>"
<?php if (in_array("two".$i, $expcheck)) {?>
checked="checked"<?php }else {echo "none";}?>>
</div>
<div class="secondc">
</div>
</div>
</div>
解决方案
在您确定它已被选中后:
document.getElementByID('yourcheckboxID').setAttribute("disabled", "true");
推荐阅读
- hover - 始终在 plotly boxplot 上显示悬停数据
- javascript - JS 单词替换代码未正确传递变量/Chrome 扩展
- laravel - 使用 Vue.js 访问数据透视表字段
- macos - 在启用阿拉伯语的 OS X 上安装 vim 的最简单方法是什么?
- javascript - 在功能组件中,如何使用 react-redux connect 从 redux store 访问 props?
- node.js - nodeJS路径模块无法解析目录路径
- node.js - Firebase 在本地测试身份验证云功能
- c++ - 代理类模板具有与表示类相同的构造函数签名
- python - 如何创建闪烁的帧 - [tkinter]
- javascript - CORS 在 Okta SignInWidget 中没有“访问控制允许来源”