jquery

Q: What is Jquery Selectors?

jQuery selectors allow you to select and manipulate HTML element(s).

jQuery selectors are used to “find” (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more. It’s based on the existing CSS Selectors, and in addition, it has some own custom selectors.

All selectors in jQuery start with the dollar sign and parentheses: $().

There are mainly 3 types of selector

  1. Element Selector
  2. Id Selector
  3. Class Selector
  4. Element Selector:

The jQuery element selector selects elements based on the element name.

Ex:

$(“p”);

  1. Id Selector:

The jQuery #id selector uses the id attribute of an HTML tag to find the specific element.

Ex:

$(“#test”)

  1. Class Selector:

The jQuery .class selector finds elements with a specific class.

Ex:$(“.test”)

Leave a comment

Your email address will not be published. Required fields are marked *