How to target elements under clicked with jQuery
html, javascript, jquery
Solution
Just use the following:
$(this).nextAll().hide();
DEMO: http://jsfiddle.net/dS2vA/1/
Problem
I want to hide everything under (but leave the ones above) the element that was clicked by the user. Check out this demo: http://jsfiddle.net/dS2vA/ So if you click on the 2nd `<li>` the three `<li>`s under it should be hidden. If you click the 4th `<li>`, only the 5th element should be hidden. I tried doing it with `:not('clicked')` but that targets the elements above the clicked element, as well. Any ideas?