It works once you’ve clicked on the first tab, since only then is the highlight(this) invoked.
It wouldn’t do that if you removed the default class=“highlight” from the first tab. But understandably you want the tab highlighted by default. Hmmm… will have to think about this a bit more.
PS
I would still recommend you look into an option that degrades more gracefully. At the moment, if someone has JS off, they can’t access your other tab sections. Here is another example that uses jQuery and degrades nicely (turn off JS to see what I mean):
Hmm, thanks for the tip, i did just try it but had no luck, i will have a play around, and in the mean time if any one can offer any suggestions i would really appreciate it
Sure, it’s css that does the styling in either case. In your example, because you are using inline JS (not best practice) I’m not experienced enough to tell you the answer.
I don’t know JS syntax well enough, but I suspect you could change this
But my JS above might be wrong, but if you know how that code works you could play with it a bit. Otherwise, someone else who knows JS will not doubt fix it up.