对于使用jquery,chosen,easyui统一进行页面元素禁用公共方法

        function disableInput() {
            var datas = { comb_ship1: "", txt_CompWOCode: "", dtp_StartDate: "", dtp_EndDate: "", txt_EstDays: "", cbo_Vendor: "", text_RepairPort: "", Discharge: "", isNav: "", cbo_ApplyType: "", cbo_Faretype: "", ProjectNumber: "", Discount: "", ReliefAmount: "", cbo_currencyid: "", txt_Memo: "" };
            SetElementDisable(datas);
        }

        function SetElementDisable(datas) {
            debugger;
            for (var x in datas) {
                var data = x;
                var $data = $("#" + data);
                if ($data.length == 0) {
                    continue;
                }
                if ($data.hasClass("easyui-numberbox")) {
                    $data.numberbox("disable");
                }
                else if ($data.hasClass("Wdate")) {
                    $data.prop("disabled", true);
                    $data.css("background-color", "#EBEBE4");
                }
                else if ($data.hasClass("easyui-combobox")) {
                    $data.combobox('disable');
                }
                else if ($data.hasClass("chosen-select")) {
                    $data.prop("disabled", true).trigger("chosen:updated");
                }
                else if ($data.prop("type") == "text") {
                    $data.prop("readonly", "readonly");
                    $data.css("background-color", "#EBEBE4");
                }
                else if ($data.prop("type") == "textarea") {
                    $data.prop("readonly", "readonly");
                    $data.css("background-color", "#EBEBE4");
                }
                else if ($data.type == "radio") {
                    $("#text").prop("data_obj");
                    var nameValue = $data.prop("name");
                    $("[name='" + nameValue + "']").prop("readonly", "readonly");
                }
                else {
                    $data.prop("disabled", true);
                    $data.css("background-color", "#EBEBE4");
                }
            }
        }
View Code
原文地址:https://www.cnblogs.com/zk3113/p/9583172.html