• Easyui 常用语法-Checkbox


    1.Checkbox隐藏与显示

    $(function () {
                $("input").on("click", function () {
                    var other = document.getElementById("").value;
                    //alert(other);
                    //alert(txt);
                    if (other != "on") {
                        $("#").next().hide();
                        //txt = "block";
                        alert(other + "11111");
                        alert(txt + "11111");
                    }
                }
               )
            })

    2.Checkbox Change事件

    $(function () {
                $("#").change(function () {
                    var val = $(this).prop("checked");
                    if (val)
                    {
                        alert(val);
                        $("#").attr("disabled", true);
                        $("#").attr("disabled", true);
                        $("#").attr("disabled", true);
                        $("#").attr("disabled", true);
                        $("#").attr("disabled", true);
                        $("#").next().hide();
                    }
                    else
                    {
                        alert(val+"11111111111");
                        $("#").attr("disabled", false);
                        $("#").attr("disabled", false);
                        $("#").attr("disabled", false);
                        $("#").attr("disabled", false);
                        $("#").attr("disabled", false);
                        $("#").attr("disabled", false);
                        $("#").next().hide();
                    }
                });

    2.Checkbox 禁止多选
            $(function () {
                $("#").change(function () {
                    //var id = document.getElementsByName("").constructor;
                    var val = $(this).prop("checked");
                    if (val) {
                        var = $('input[name=]').val();
                        //$('input[name=]').attr("disabled", true);
                        $("input[name=]").prop("disabled", true);
                        $("input[name=]").prop("disabled", true);
                        $("input[name=]").prop("disabled", true);
                        $("input[name=]").prop("disabled", true);
                        $("input[name=]").prop("disabled", true);

                        $("#").next().show();
                        $('#').textbox('readonly', false);
                        $("#").textbox({ required: true });
                        $('#').checkbox('disableValidation')//在弹出窗体的方法里先去除验证的样式
                        $('#').checkbox('enableValidation')//在保存的方法里再加上需要验证的样式
                    }
                    else {
                        $("input[name=]").prop("disabled", false);
                        $("input[name=]").prop("disabled", false);
                        $("input[name=]").prop("disabled", false);
                        $("input[name=]").prop("disabled", false);
                        $("input[name=]").prop("disabled", false);
                        $("input[name=]").prop("disabled", false);
                        $("#").next().hide();
                        //$("#").("disabled", true);
                        $('#').textbox('readonly', true);
                        $("#").textbox({ required: false });
                        $("#").textbox({ required: false });
                        $("#").textbox('setValue', '')//清空文本框
                    }
                });
            })    

    3.Checkbox 只能选择一个

    $(function checkCheckBox() {
                $('#').find('input[id=]').bind('click', function () {
                    var id = $(this).attr("id");
                    var name = $(this).attr("name");
                    if (name == "" || name == "" || name == "" || name == "") {
                        $("#").textbox({ required: false });
                    }
                    else {
                        $("#").textbox({ required: true });
                    }
                    //当前的checkbox是否选中
                    if (this.checked) {
                        //除当前的checkbox其他的都不选中
                        $("#fm").find('input[id=]').not(this).attr("checked", false);
                        //选中的checkbox数量
                        var selectleng = $("input[id='']:checked").length;

                        console.log("选中的checkbox数量" + selectleng);
                    } else {
                        //未选中的处理
                        console.log("未选中的处理");
                    }
                });
            })

  • 相关阅读:
    如何解决“德语/文”等外文字符显示乱码问题
    HTML+CSS大作业:旅游网页设计与实现——旅游风景网站6页HTML+CSS+JavaScript实训大作业 HTML+CSS大作业 HTML期末大作业
    黑马程序员 学成在线项目 第1章 项目介绍&环境搭建v3.1
    7、IOC 之Bean定义继承 parent
    云计算 - 3 - 使用MapReduce处理数据
    舆情监测是什么?对企业营销来说有什么作用?
    Linux 之文件查找
    【【萌新的FPGA学习之分频器的介绍】】
    苯硫酚荧光探针 激发波长465 nm
    国外网站国内镜像
  • 原文地址:https://blog.csdn.net/po_xiao_/article/details/126506102