javascript - Change Menu Styling on fly or pass a param inside jQuery .each iterator -
I have a bunch of menu links and want to change my style on click - say "about you" Click and make it bold and red. I select the item and click them Add event:
$ ("# nav_menu> gt; *") Tie ("click", function () {doTrigger (this.id);});
In this way I pass the ID of the clicked item to doTrigger
.
Okay. Now in doTrigger
I am trying to iterate through the items and change their styles: style1 for example style2 The problem is that:
$ ("# nav_menu> gt; *") Each (function () {;});
I will not give the ID of the clicked item.
I think that there must be a less complex way of achieving what I need. Besides, I think I'm also losing.
Try something like this:
This resets all children to class1
when an item is clicked, and then only that item was class2
is.
Comments
Post a Comment