How to select and hide all but first 5 elements in a HTML file (DOM)
- by Zhen
I am attempting to use coffeescript/jQuery to do the following:
1) Retrieve all the 'topics' displayed in the html (seen below)
2) Hide all the topics from display except for the first 5 listed.
I tried to do the following but is not working
//Retrieve the entire list of and hide all but the first 5 topics in the list
$(".topics .topic")[5..-1].hide()
Can someone advise me on how I can correctly retrieve the list of topics from the HTML document and subsequently hide ALL but the first 5 topics?