[<li>karl</li> <li>Tane</li>]
--------------------------------------------------------------------------------
: First-child
Match first child element
': A ' matches only one element, and this selector matches one child element for each parent element
Matches the "the" the "the" of its parent.
While ': "Matches only" a single ", this matches the then one:one for each parent.
return value
Array<element>
Example
Find the first Li in each UL
HTML Code:
<ul>
<li>John</li>
<li>Karl</li>
<li>Brandon</li>
</ul>
<ul>
<li>Glen</li>
<li>Tane</li>
<li>Ralph</li>
</ul>
JQuery Code:
Results:
[<li>john</li> <li>Glen</li>]
--------------------------------------------------------------------------------
: Last-child
Match the Last child element
': Last ' matches only one element, and this selector matches one child element for each parent element
Matches the last child of its parent.
While ': "Last ' matches" a single element, this is matches more then one:one for each parent.
return value
Array<element>
Example
Find the last Li in each UL
HTML Code:
<ul>
<li>John</li>
<li>Karl</li>
<li>Brandon</li>
</ul>
<ul>
<li>Glen</li>
<li>Tane</li>
<li>Ralph</li>
</ul>
JQuery Code:
Results:
[<li>brandon</li> <li>Ralph</li>]
--------------------------------------------------------------------------------
: Only-child
If an element is the only child element in the parent element, it will be matched
If the parent element contains other elements, it will not be matched.
Matches the only child of its parent.
If the parent has other child elements, it is matched.
return value
Array<element>
Example
Find the only child element in the UL of Li
HTML Code:
<ul>
<li>John</li>
<li>Karl</li>
<li>Brandon</li>
</ul>
<ul>
<li>Glen</li>
JQuery Code:
Results:
--------------------------------------------------------------------------------
: input
Match all input, textarea, select, and button elements
Matches all input, textarea, select and button elements.
return value
Array<element>
Example
Find all input elements
HTML Code:
<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 Code:
Results:
[<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
Match all single-line text boxes
Matches all input elements of type text.
return value
Array<element>
Example
Find all text boxes
HTML Code:
<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 Code:
Results:
--------------------------------------------------------------------------------
:p Assword
Matches all input elements of type password.
return value
Array<element>
Example
Find all Password boxes
HTML Code:
<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 Code:
Results:
[<input type= "password"/>]
--------------------------------------------------------------------------------
: Radio
Matches all input elements of type radio.
return value
Array<element>
Example
Find all radio buttons
HTML Code:
<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 Code:
Results:
--------------------------------------------------------------------------------
: Submit
Matches all input elements of type submit.
return value
Array<element>
Example
Find all Submit buttons
HTML Code:
<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 Code:
Results:
[<input type= "submit"/>]
Others are the same reason: image,: Reset,:button,:file,:hidden!@#@!%$%