I have been reading a lot on how to highlight / style links to show the user their current page. None of the solutions seem to work. I have a navbar with links such as <a href="/foo/">
and a dropdown with <a href="/foo/bar">
and when the current page is /foo/bar
I want to add a class to both links (/foo/
and /foo/bar
).
I have tried using the solutions on CSS-Tricks and tried writing my own jQuery but have not been able to select ALL of the correct DOM elements.
Is there a better jQuery solution or a way to do this server-side?