在我的应用程序中,我有来自Link的带有引导切换按钮的客户表单
在视图中,我的HTML代码是
input type="checkbox" name="" class="onoffswitch3-checkbox" id="myonoffswitch3" data-format="Y-m-d" required >
<label class="onoffswitch3-label" for="myonoffswitch3">
<span class="onoffswitch3-inner">
<span class="onoffswitch3-active"><span class="onoffswitch3-switch" id="onoffswitch3-switch">Active</span></span>
<span class="onoffswitch3-inactive"><span class="onoffswitch3-switch" id="onoffswitch3 the switch">Inactive</span></span>
</span>
</label>
I在数据库中我有字段'status‘
0 => Inactive
1 => Active
如何为.onoffswitch3-checkbox赋值?我试了很多,但没有成功。
我会非常感谢你的。
发布于 2018-03-14 20:21:25
我不在岸上你可以给复选框赋值0,未选中的复选框没有值。
下面是如何选中/取消选中复选框。
//Javascript
document.getElementById("onoffswitch3-switch").checked = true;
document.getElementById("onoffswitch3-switch").checked = false;
//jquery
$(".onoffswitch3-checkbox").prop("checked", true);
$(".onoffswitch3-checkbox").prop("checked", false);
发布于 2018-03-15 05:39:34
感谢你们所有人的帮助。
我实现了javascript,但运行不正常。
但是我已经实现了以下一行代码
<input type="checkbox" name="statusupd" class="statusupd" value="<?php echo $employee->status;?>" <?php if ( $employee->status == 1) { echo 'checked disabled'; } ;?>
再次感谢你们所有人。
https://stackoverflow.com/questions/49271073
复制相似问题