In #9 press n, what does .next() function really do? How does it know where to go next?


Please answer, thanks


Hi Jhepong,

The jQuery next() function scans the HTML and looks for the next sibling of the current element in the HTML. So,

<div class="one"> <!-- current element -->
<div class="two"> <!-- this is .one's next sibling, so .next() == this <div> -->

There's not much to it :slightly_smiling:


how do you program if there is no more next sibling (like .next()=null) and you want to select back the very first sibling


@jhepong This lesson teaches you how to do exactly that :slightly_smiling: Keep working through the exercises, and you'll see :slightly_smiling:


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.