Home >Web Front-end >JS Tutorial >jQuery: Detailed explanation of the use of input selector

jQuery: Detailed explanation of the use of input selector

黄舟
黄舟Original
2017-06-23 15:19:471275browse

Overview

Match all input, textarea, select and button elements

Example

Description:

Find all input elements, the following elements will be matched.

HTML Code:

<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 Code:

$(":input")

Result:

[ <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>, ]

This selector matches all input element. For example: 22e1bb649e3e439c82b64204a5f95e3f etc.

Grammar structure:

$(":input")

Example code:






:input选择器-脚本之家
 
 
 
 
  • 读书

For the above code, click the button# After ##, the input element can be hidden.

The above is the detailed content of jQuery: Detailed explanation of the use of input selector. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn