traversing jquery

Solutions on MaxInterview for traversing jquery by the best coders in the world

showing results for - "traversing jquery"
Lennart
20 Feb 2020
1$("#demo").parent();                // accessing direct parent
2$("span").parent().hide();          // changing parent color
3$("#demo").parents();               // all ancestors of the element
4$("#demo").parentsUntil("#demo2");  // all ancestors between two - demo is inside demo2
5$("#demo").children();              // all direct children
6$("#demo").children(".first");      // all direct children having a specified class
7$("#demo").find("span");            // all span elements inside #demo
8$("#demo").find("*");               // all descendants
9$("#demo").siblings("span");        // span siblings of #demo
10$("#demo").next();                  // the next sibling
11$("p").nextAll();                   // all next siblings
12$("#demo").nextUntil("#demo2");     // siblings between two arguments
13$("#demo").prev();                  // the previous sibling
14$("p").prevAll();                   // all previous siblings
15$("#demo").prevUntil("#demo2");     // previous siblings between two arguments
16