So what I want to do is determine if the current link is 'active', i.e. if this link was just clicked by the user.
If it is, then I want to apply the class=selected
to that <li>
item.
So this is what I am working with:
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
<li><a href="#">Link 5</a></li>
</ul>
If a link is selected, I want the <li>
to look like this:
<li class="selected"><a href="#">Link 1</a></li>
So the only differences is that one has a class applied to it, and the other doesn't.
I want to do this in an erb
file. So Ruby would be the language of choice...although, it's not Rails (Sinatra to be exact).
Thanks.
Edit 1
Using jQuery might be necessary and that will be fine.