jquery清除表单中所有元素的值
来源:互联网 发布:windows隐私声明 编辑:程序博客网 时间:2024/05/22 07:48
1.$(':input','#myform') 2. .not(':button, :submit, :reset, :hidden') 3. .val('') 4. .removeAttr('checked') 5. .removeAttr('selected');
清楚表单内所有元素的值,包含了所有的情况。
It is using the :input
selector which will match all input, textarea, select and button elements. Since we are passing #myform
as the second argument, it will only find inputs inside this form
element. Then it filters out all buttons, submits, resets and hidden
inputs using not()
. Then it is using val()
to set the value of the remaining fields to an empty string, and then it uses removeAttr
to remove the checked
and selected
attribute of the fields in case you have any radio/checkbox/select inputs. Tada.
很强大,包括了所有的情况
- jquery清除表单中所有元素的值
- jquery让表单中所有可编辑元素均为只读的方法
- 用jQuery清除元素所有子节点
- jquery禁用form表单中所有的表单项
- jquery禁用form表单中所有的表单项
- jQuery中获取表单元素的值以及一些操作表单的方法
- jQuery获取form表单元素的值
- jQuery获取form表单元素的值
- jquery 获取表单元素里面的值
- jQuery 如何获取表单元素的值
- jQuery获取表单各元素的值
- jquery 获取表单元素里面的值
- jQuery获取form表单元素的值
- 将javascript对象的所有属性放到匹配name值的表单元素中
- PHP用正则匹配form表单中所有元素的类型和属性值
- jquery获取元素值的方法(常见的表单元素)
- jquery mobile的表单元素
- 关于jquery获取表单中一下简单的元素的值
- 输入框最多能输入2位小数的限制
- 我眼中的面向对象技术
- Oracle查看进程执行sql
- js 在展示关于有 html标签 时候需要转义
- FusionCharts常规用法介绍
- jquery清除表单中所有元素的值
- HNOI 2002 营业额统计 Splay Tree
- mtk android 编译命令
- Spring3核心技术之JdbcTemplate
- 编译i-jetty
- Due to "No space left on device", Many Concurrent Manager are under 'No Manager' Status
- 使用反射获取一个类的所有方法和字段
- UIView删除所有子view
- wince c# Timer的使用