jQuery Selectors
jQuery Selector
JQuery Selectors are used for selecting the elements on which some actions are needed to be performed. Selecting an element in jQuery is similar to that selected in CSS. The jQuery selectors start with the dollar sign and parentheses: $().
Some Selectors are:-
Selector |
Sample |
Description |
* | $("*") | Selects all Elements |
div | $("div") | Selects all "div" elements |
.class | $(".class") | Selects all elements with class="class" |
#my_id | $("#my_id") | Selects all Elements with id="my_id" |
:first | $("p:first") | Select only first "p" element |
:last | $("h2:last") | Select only last "h2" element |
:input | $(":input") | All input element |