<div class="layui-col-xs4">
<label class="layui-form-label">预计下塔所需时间(分钟)</label>
<div class="layui-input-block">
<input type="text" name="needTime" id="needTime" class="layui-input" style="border: 1px solid #c2c2c2;"
>
</div>
</div>
这个是开关按钮
<div class="layui-col-xs4">
<label class="layui-form-label">是否影响线路强送电</label>
<c:if test="${log.isEfectSendElec==null || log.isEfectSendElec=='不影响'}">
<input type="checkbox" name="isEfectSendElecclose" id="isEfectSendElec" lay-skin="switch" lay-filter="switchText"
lay-text="是|否">
</c:if>
<c:if test="${log.isEfectSendElec=='影响'}">
<input type="checkbox" name="isEfectSendElecopen" id="isEfectSendElec" lay-skin="switch" lay-filter="switchText"
onclick=""
lay-text="是|否"
checked="checked">
</c:if>
</div>
这个是我写的js代码
form.on('switch', function(data){
var elem = data.elem;
var swithcData = data;
var id = data.value;// 获取要修改的ID
var state = this.checked ? '影响' : '不影响';// 当前状态值
if (state ==='影响'){
layer.msg('数据异常,操作失败!1111');
}
各位大佬,在页面上选择了是input框才可以输入,没选就不给输入,想问一下怎么写呢?我是小白,谢谢各位了