在这里,总结了下jQuery的表单元素选择器,都有哪些表单元素选择器,表单元素选择器的具体使用方法,并通过具体的实例,介绍各个表单元素选择器的具体使用方法。
jQuery的表单元素选择器列表如下:
1. :input 匹配所有 input, textarea, select 和 button 元素
2. :text 匹配所有的单行文本框
3. :password 匹配所有密码框
4. :radio 匹配所有单选按钮
5. :checkbox 匹配所有复选框
6. :submit 匹配所有提交按钮(只匹配 type="submit" 的input或者button)
7. :image 匹配所有图像域
8. :reset 匹配所有重置按钮
9. :button 匹配所有按钮
10 :file 匹配所有文件域
$(":input")
[
<input type="button" value="Input Button"/>,
<input type="checkbox" />,
<input type="file" />,
<input type="hidden" />,
<input type="image" />,
<input type="password" />,
<input type="radio" />,
<input type="reset" />,
<input type="submit" />,
<input type="text" />,
<select><option>Option</option></select>,
<textarea></textarea>,
<button>Button</button>,
]
$(":text")
[ <input type="text" /> ]
$(":password")
[ <input type="password" /> ]
$(":radio")
[ <input type="radio" /> ]
$(":checkbox")
[ <input type="checkbox" /> ]
$(":submit")
[ <input type="submit" />, <button></button> ]
$(":image")
[ <input type="image" /> ]
$(":reset")
[ <input type="reset" /> ]
$(":button")
[ <input type="button" />,<button></button> ]
$(":file")
[ <input type="file" /> ]
<form>
<input type="text" />
<input type="checkbox" />
<input type="radio" />
<input type="image" />
<input type="file" />
<input type="submit" />
<input type="reset" />
<input type="password" />
<input type="button" />
<select><option/></select>
<textarea></textarea>
<button></button>
</form>
欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |