禁用form表单中所有控件
2015-07-28 19:50
666 查看
//禁用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); } }); }
需要jquery支持,测试版本为jquery-1.7.2.min.js
相关文章推荐
- 7月27日-----正则表达式、线程
- Android 开发者必备的八款小工具
- poj 次短路 dijkstra
- mongodb的锁及原子性
- VS2008设置内存断点
- HDU 5317 RGCDQ
- Android异步HTTP请求框架Volley的使用
- 【JVM】垃圾收集器
- (九十四)集成PKRevealController实现左右抽屉视图
- iOS 调取iPhone本地相册和开启相机
- nyoj 苹果
- C++实现二叉树相关操作
- HDU 5316 Magician 线段树
- 杭电 1022火车进站
- (九十四)集成PKRevealController实现左右抽屉视图
- hdu 5317 RGCDQ 筛法+线段树解法
- poj 3083 Children of the Candy Corn(广度搜索)
- HDU 1059 Dividing 多重背包二进制优化
- tinyxml源码解析(上)tinyxml源码解析(上)http://www.cnblogs.com/marchtea/archive/2012/11/09/2762669.html
- hdu 5317 RGCDQ 筛法+线段树解法