jquery禁用form表单中的文本框
 //禁用form表单中所有的input[文本框、复选框、单选框],select[下拉选],多行文本框[textarea]
            function disableForm(formId, isDisabled) {
                var attr = "disable";
                if (!isDisabled) {
                    attr = "enable";
                }
                $("form[id='" + formId + "'] :text").attr("disabled", isDisabled);
                $("form[id='" + formId + "'] textarea").attr("disabled", isDisabled);
                $("form[id='" + formId + "'] select").attr("disabled", isDisabled);
                $("form[id='" + formId + "'] :radio").attr("disabled", isDisabled);
                $("form[id='" + formId + "'] :checkbox").attr("disabled", isDisabled);
//禁用jquery easyui中的下拉选(使用input生成的combox)
                $("#" + formId + " input[class='combobox-f combo-f']").each(function () {
                    if (this.id) {
                        alert("input" + this.id);
                        $("#" + this.id).combobox(attr);
                    }
                });
                //禁用jquery easyui中的下拉选(使用select生成的combox)
                $("#" + formId + " select[class='combobox-f combo-f']").each(function () {
                    if (this.id) {
                        alert(this.id);
                        $("#" + this.id).combobox(attr);
                    }
                });
                //禁用jquery easyui中的日期组件dataBox
                $("#" + formId + " input[class='datebox-f combo-f']").each(function () {
                    if (this.id) {
                        alert(this.id)
                        $("#" + this.id).datebox(attr);
                    }
                });
            }
posted on 2018-01-23 15:52 Ryanyanglibin 阅读(736) 评论(0) 收藏 举报
                    
                
                
            
        
浙公网安备 33010602011771号