Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    hyperlocal-marketplace-guide

    jQuery Traversing

    In this blog we will learn about jQuery Traversing.
    jQuery traversing are used to find or select HTML elements. For example if you want to select data just after the selector, or select grand data of selector, or select children data of selector or if you want to select children element of selector then you can select by the use of traversing.
    There are many types of traversing but basically there three types of traversing:-
    1) Parent
    2) Children
    3) Siblings

    Lets see example:

    In this example we have made some colorful  div assigned as Great grand parent, Grand parent, Parent, children. In this example we will see how by selecting one div we will select other div. Check output after each example.

    Above we have selected children as the selector therefore the text is coming inside the Children div.

    Now change only script section from above written code for next example.


    Here we have selected parent of children and parent of children is white section therefore the text is coming inside the white section.

    Now change only script section from above written code for next example.


    Here we have selected selector as parents of children and parents of children are white,green,yellow,gray and even main div  therefore the text is coming inside the all the section.

    Now change only script section from above written code for next example.

    Here we have selected selector as  $(“.children”).parents(‘.grandparent_parents’) means children parents whose class is grandparent_parents therefore the text is coming inside yellow section because yellow section class is grandparent_parents.

    Now change only script section from above written code for next example.


    Here we have selected selector as  $(“.children”).parentsUntil(‘.grandparent_parents’) means all the parent will be selected Until you get the Grand parent.

    So here we ends with some example of jQuery traversing.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close