The Document Object Model (DOM) elements are something like a DIV, HTML, BODY element on the HTML page. A jQuery Selector is used to select one or more HTML elements using jQuery. Mostly we use Selectors for accessing the DOM elements. If they are only one particular unique element in the HTML page we can access it by it’s tag as
$("tag"), but when we have more than one of its kind then we will access them with the ID that when
$("#id") comes into play.
Below examples illustrates the approach.
Example 1: This eaxmple will use the $(“selector”).get(0):
Example 2: This eaxmple will illustrates the use of $(“selector”) selector.
- jQuery | element Selector
- jQuery | element + next Selector
- jQuery | element ~ siblings Selector
- jQuery | * Selector
- jQuery | :first Selector
- jQuery | :odd Selector
- jQuery | :even Selector
- jQuery | :lt() Selector
- jQuery | :gt() Selector
- jQuery | :has() Selector with example
- jQuery | :contains() Selector
- jQuery | :not() Selector
- jQuery | #id Selector
- jQuery | :last Selector
- jQuery | :enabled Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.