COPY CODE SNIPPET

JQUERY SELECTORS

Jquery Selectors

 Jquery selectors are one of the most  key parts of the jquery library selectors allows us to select and manipulate HTML  dom element/ elements.

 Jquery selectors are required at every step while using jquery  because without   selecting the html dom element, any action can't be performed.

 Jquery selector  is a function which makes use of expression to find out matching element from a DOM based on given criteria

.

These are the following jquery selectors.

         1. TagId -  Select the element using tag Id 

      example

                  $("#id1") - It selects an element that uses an Id of id1.

       

         2. TagName - Select the element/ elements  using specified tagname

      Example

                 $("P")  -  It Selects all elements  matched by <P>

        

         3. ClassName -  Select all the   elements that usess class of class.

      Example


                $(".class1")- It selects all the elements which are matched with any tag  that uses a  classname as class1.

            

                $("P.class1") - It selects all the elements matched by <P> that uses a class of class1.


        4. multiple  elements - It selected multiple elements  specified by a common separator.

     Example

                  $("P,div, span ")  - It selects all the elements matched by <div>, <P> as well as <span>.

                 

                    $("#id1,  P") - It elects an element matched by id of id1 as  well as all elements matched by <P>.

 

                           $("div.class1, P") - It selects all the elements matched by <div> with a class of class1  as well as elements matched by <P>.


     5. All Elements - It selects  all the DOM elelments.

                     Example

                            $("*")

   

     6. Current Elements - It select  the current element  on which it has been used.

                     Example

                          $(this)

                         

JQUERY SELECTORS JQUERY SELECTORS Reviewed by Unknown on 00:03 Rating: 5

No comments:

COPY CODE SNIPPET
Powered by Blogger.