input 监听输入事件

$("#" + inputId).on("input", function () {
                var checkboxId = $("#" + inputId).attr("target");
                if ($("#" + inputId).val().length == 0) {
                    //关闭复选框
                    if ($("#" + checkboxId).next().hasClass("layui-form-checked"))
                    {
                        $("#" + checkboxId).next().click();
                    }
                } else {
                    //开启复选框
                    if (!$("#" + checkboxId).next().hasClass("layui-form-checked")) {
                        $("#" + checkboxId).next().click();
                    }
                }
            })

  

猜你喜欢

转载自www.cnblogs.com/liuqiyun/p/9436624.html