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("未选中的处理");
                }
            });
        })

相关文章

学习编程是顺着互联网的发展潮流,是一件好事。新手如何学习...
IT行业是什么工作做什么?IT行业的工作有:产品策划类、页面...
女生学Java好就业吗?女生适合学Java编程吗?目前有不少女生...
Can’t connect to local MySQL server through socket \'/v...
oracle基本命令 一、登录操作 1.管理员登录 # 管理员登录 ...
一、背景 因为项目中需要通北京网络,所以需要连vpn,但是服...