hi,
I'm very new to js so kindly help me with this.
I am trying to add a class to a tag using onClick.
The code is as shown below:
<a class="gkvSprite" href="#" id="abc" onClick="showhide('1')">Click 1</a>
<a class="gkvSprite" href="#" id="def" onClick="showhide('2')">Click 2</a>
<a class="gkvSprite" href="#" id="hij" onClick="showhide('3')">Click 3</a>
Now when i click i need to add a class called "selected" for the one i select. I tried using setAttribute and add class of jquery as well but was not successful
When i alert the document.getelementbyId(123) it gives out the link.
Can someone kindly help me?
Thanks in Advance
Alloi