What is Selector??

As a name implies, selectors allow us to select the elements/properties like div, span., to performing actions on it.

What is use of it ??

A Selector identifies an HTML tag/element by using selector to manipulate(like apply css, delete the div…) with jQuery code.

Types of Selector :

  • ID/Tag ID Selector:

Represents a tag available with the given ID in the DOM. In simple, select the matched elements which has the same id.

Example : $(“#userid”)

<div id=”userid”></div>

  • Class/Tag Class Selector:

It represents a tag available with the given class in the DOM. In simple, select the matched elements which has the same class.

Example : $(“.userid”)

<div class=”userid”></div>

  • Tag Name/Element Selector :

It represents a tag name available in the DOM, In simple, select eh matched DOM/element
which has the same type

Example : $(“p”)

<p id=”userid”></p>