Topic: Using DOM to dynamically add a class to an 'a' tag (Page 1 of 1) |
|
---|---|
Neurotic (0) Inmate Newly admitted From: |
posted 11-16-2009 19:24
I am using a tabbed panel layout (JQuery) and when a tab is clicked 'class="current"' is dynamically added to the 'a' tag. The only trouble is I want to change the default 'current tab' when the page loads so I am hoping I can add 'class="current"' to the tab I require using DOM. I am very new to this so would be very grateful for any direction. I was planning on calling the Javascript code using an 'onload' event. Any help would be gratefully appreciated. |
Paranoid (IV) Inmate From: London |
posted 11-17-2009 11:11 |
Lunatic (VI) Inmate From: under the bed |
posted 11-17-2009 18:10
How is the default tab currently designated? |
Neurotic (0) Inmate Newly admitted From: |
posted 11-26-2009 06:54
code: $(document).ready(function() { $(".classOfYourContainer a").addClass("current"); });
|
Obsessive-Compulsive (I) Inmate From: |
posted 11-26-2009 16:35
Thank you very much - I'll give it a go. |