码迷,mamicode.com
首页 > 其他好文 > 详细

:input 匹配所有 input, textarea, select 和 button 元素

时间:2016-12-30 13:04:24      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:form   check   jquer   code   input   button   htm   reset   checkbox   

描述:

查找所有的input元素,下面这些元素都会被匹配到。

HTML 代码:
<form>
    <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>

</form>
jQuery 代码:
$(":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>,
 ]

:input 匹配所有 input, textarea, select 和 button 元素

标签:form   check   jquer   code   input   button   htm   reset   checkbox   

原文地址:http://www.cnblogs.com/winyh/p/6236407.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!