I have a menu, I want to add class “current” to the <li> with id="home", so this is what I tried:
$('#main-nav ul li').attr('id').eq('home').addClass('current');
I also tried .is instead of .eq, non of them works!
How I could achieve this?
Thanks
You can easily select for specific ids with the CSS id selector #.
Depending on your DOM, you can even be more specific with your selectors, which will result in faster selection of the dom element: