jQuery选取表单元素

表单元素选择器

选择器                    说明


 

:button                 <button>元素和type属性值为button的<input>元素。


 

:checkbox             type属性值为checkbox的<input>元素。使用$([type="checkbox"])能获得更高的性能。


 

:checked               选中的单选按钮和复选框元素。


 

:disabled               所有被禁用的元素。


 

:enabled               所有被启用的元素。


 

:focus                  当前焦点所在的元素。使用$(document.activeElement)能获得更高性能。


 

:file                     所有文件选择器元素。


 

:image                 所有图片按钮。使用[type="image"]更优 。


 

:input                  所有<button>、<input>、<select>、<textarea>元素。先选中元素再使用.filter(":input")更优。  


 

:password            所有密码输入框。使用$("input:password")更优。


 

:radio                  所有单选按钮。需要选择一组单选按钮时,可以使用$("input[name='info']:radio")。


 

:reset                  所有重置按钮。


 

:selected              所有被选中的元素。在.filter()方法中使用css选择器更优,比如:.filter(":selected")。


 

:submit                <button>元素和type属性值为submit的,<input>元素。使用[type="submit"]更优。


 

:text                  选取所有type属性值为text或未指定type属性的<input>元素。使用('input:text')更优。

posted @ 2016-05-03 22:53  蔷薇蔓蔓  阅读(603)  评论(0编辑  收藏  举报