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

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -