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?
$(".topics .topic").slice(5).hide();
http://api.jquery.com/slice/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With