[ <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" /> ]
--------------------------------------------------------------------------------
:text
匹配所有的单行文本框
Matches all input elements of type text.
返回值Array<Element>
示例查找所有文本框
HTML 代码:
<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>
jQuery 代码:
$(":text")
结果:
[ <input type="text" /> ]
--------------------------------------------------------------------------------
:password
匹配所有密码框
Matches all input elements of type password.
返回值Array<Element>
示例查找所有密码框
HTML 代码:
<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>
jQuery 代码:
$(":password")
结果:
[ <input type="password" /> ]
--------------------------------------------------------------------------------
:radio
匹配所有单选按钮
Matches all input elements of type radio.
返回值Array<Element>
示例查找所有单选按钮
HTML 代码:
<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>
jQuery 代码:
$(":radio")
结果:
[ <input type="radio" /> ]
--------------------------------------------------------------------------------
:submit
匹配所有提交按钮
Matches all input elements of type submit.
返回值Array<Element>
示例查找所有提交按钮
HTML 代码:
<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>
jQuery 代码:
$(":submit")
结果:
[ <input type="submit" /> ]
其他的一些 都是一样的道理:image ,:reset,:button,:file,:hidden !@#@!%$%
您可能感兴趣的文章: