Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
suppose you have HTML DOM like this

<div class="test1">
       <div class="test2">
       </div>
       <div class="test3">
       </div>
</div>

<div class="test1">
       <div class="test2">
       </div>
       <div class="test3">
       </div>
</div>


on click of test 2 i want test 3 to be displayed else display none;

What I have tried:

i tried to use this but that can be applied only if same class is applied to both the sibling
Posted
Updated 6-Nov-17 5:09am
v2

1 solution

Check out the nextElementSibling[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900