Forecast toggle


#1

I'm really confused and got stuck on this project. It's question 3 - when .div is clicked, toggle the following .hourly div which is next sibling? I have tried different approach like using:
$(this).siblings('.hourly').toggle('.hourly');
$('.day + .hourly').toggle('.hourly');
$(this).toggle('.hourly');

All of these work, however it toggles all the days and not specific day clicked! Has anyone solved this and can you please help I'm stuck and got no clue what to do! Thanks


#2

Got it after much of pain, here's the line in case someone else needs in the future... $(this).next().toggle('.hourly');


#3

thanks @deeqoo ! helped a bunch!


#4

Since this topic is reopened, we may as well delve into the components in play, $(this) and $(this).next().

    <div class="day row">
       <!-- $(this) -->
    </div>
    <div class="hourly row">
      <!-- $(this).next() -->
    </div>

From the standpoint of existing structure we don't need to know the class, only that it is the next sibling.

$(this).next().slideToggle('slow');

We have enough hooks just in the tree alone that class is moot.