please click here for more wordpress cource
JQuery selectors are used to select and manipulate HTML elements on a web page. Here are some commonly used jQuery selectors:
- Element Selector: Selects all elements with the specified tag name. For example, $(“p”) selects all <p> elements.
- ID Selector: Selects an element with a specified id attribute. For example, $(“#myId”) selects an element with id=”myId”.
- Class Selector: Selects all elements with a specified class attribute. For example, $(“.myClass”) selects all elements with class=”myClass”.
- Attribute Selector: Selects all elements that have the specified attribute, with a specified value. For example, $(“input[type=’text’]”) selects all <input> elements with type=”text”.
- Descendant Selector: Selects all elements that are descendants of a specified element. For example, $(“ul li”) selects all <li> elements that are descendants of <ul> elements.
- Child Selector: Selects all elements that are immediate children of a specified element. For example, $(“ul > li”) selects all <li> elements that are direct children of <ul> elements.
- Sibling Selector: Selects all elements that are siblings of a specified element. For example, $(“h1 + p”) selects all <p> elements that come immediately after <h1> elements.
These are just a few examples of the many jQuery selectors available. By using these selectors, you can easily manipulate and interact with elements on a web page.