打赏

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();
                    }
                }
            })

  

posted @ 2018-08-07 14:00  刘奇云  阅读(3675)  评论(0编辑  收藏  举报