发布于 3年前

Layui radio单选框 监听

<div class="layui-form-item" pane="">
    <label class="layui-form-label">节点</label>
    <div class="layui-input-block">
        <input type="radio" name="sex" value="左节点" title="左节点" lay-filter="jiedian" >
        <input type="hidden" name="leftjiedian" id="zjidian">
        <input type="radio" name="sex" value="右节点" title="右节点" lay-filter="jiedian">
        <input  type="hidden" name="rightjiedian" id="rjidian">
    </div>
</div>
form.on('radio(jiedian)', function (data) {
    //alert(data.elem);
    //console.log(data.elem);
    alert(data.value);//判断单选框的选中值
    var abc=data.value;
    if(abc=="左节点"){
       $("#zjidian").val("1");
        $("#rjidian").val("");
      // alert($("#zjidian").val());
    }else{
        $("#rjidian").val("1");
        $("#zjidian").val("");
      //  alert($("#rjidian").val());
    }

     //console.log(data.value);
     //alert(data.othis);
    //layer.tips('开关checked:' + (this.checked ? 'true' : 'false'), data.othis);
    //layer.alert('响应点击事件');
});

相关文章

©2020 edoou.com   京ICP备16001874号-3