aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Highlighting a menu tab when a sub-menu link below it is clicked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Highlighting a menu tab when a sub-menu link below it is clicked" Watch "Highlighting a menu tab when a sub-menu link below it is clicked" New topic
Author

Highlighting a menu tab when a sub-menu link below it is clicked

anita prat
Greenhorn

Joined: Aug 11, 2011
Posts: 8
Hi,
I have 4 tabs in my jsp and each have 1 or drop-down links below them. The requirement is to highlight the main tab when one of the drop-down links are clicked. Currently the first tab is harcoded to be highlighted , I need to have a javascript which should dynamically highlight the tab upon onclick. How can I achieve this?

In my css:

In the html:
<li class="tab">

<a href="#" id="cust" >Customer</a>
<div id="m0" >
<a href="#">Add</a>
<a href="#">Remove</a>
</div>
<a href="#" id="comp" >Company</a>
<div id="m1" >
<a href="#">Add</a>
<a href="#">Remove</a>
</div>

</li>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Highlighting a menu tab when a sub-menu link below it is clicked