Yo ninjas, in this jQuery tutorial, I’ll show you how we can traverse up and down the DOM with a few cool and easy jQuery methods.

jQuery essentially wraps an API layer around the DOM, giving us access to these new methods, making our lives as JavaScript developers much much easier :).


========== JavaScript for Beginners Playlist ==========

========== CSS for Beginners Playlist ==========

========== HTML for Beginners Playlist ==========

========== The Net Ninja ============

For more front-end development tutorials & to black-belt your coding skills, head over to – or

========== Social Links ==========

Twitter – @TheNetNinja –


  1. In terms of the .closest() method: You gave an example in which the closest wrapper was above "#social-nav". If there were a wrapper beneath "#social-nav", which in this case would be closer, would the .closest() method recognize the wrapper beneath it as it is closer? Or does the .closest() method only work upward?

  2. {
    $("img[alt=map]").css({border:"3px solid brown"});

    $("#contact-methods").next().css({border:"3px solid brown"}):

    $("#csocial-nav").prev().css({border:"3px solid brown"}):
    what is the difference between above codes???….all have similar outputs…

  3. for the last one, so it finds closest parents of ".wrapper", not "#social-nav"? what if I just type $(".wrapper").closest()?


Please enter your comment!
Please enter your name here