What is jQuery Selectors? Give some examples

Selectors are used in jQuery to find out DOM elements. Selectors can find the elements via ID, CSS, Element name and hierarchical position of the element.

Selector       Example                 Selects

 *                 $("*")                    All elements
 #id              $("#lastname")        The element with id=lastname
 .class           $(".intro")               All elements with class="intro"
 element        $("p")                     All p elements

No comments:

Post a Comment