Help - Changing object using a class identifier not working
Here is my code:
- <div id="GroupMenu">
- <div id="navPremium2">
- <ul id="ulList" >
- <li id="liHome" class="GSTab" onclick="GSToggle(this)">
- </li>
- <li id="liAbout" class="GSTab" onclick="GSToggle(this)">
- </li>
- </ul>
- </div>
- </div>
- <script type="text/javascript">
- $(document).ready(function () {
- });
- function GSToggle(CurrentTab, Opt) {
- $(".GSTab").removeClass("selected");
- $('#liHome')[0].className = "GSTab";
- $('#liAbout')[0].className = "GSTab";
- $(CurrentTab)[0].className = "selected";
- }
- </script>
My problem is that line 20 does not work, it does nothing.
All I am trying to do is set a "selected" class on the "li" object that has been clicked.
The next three lines seem to work/
I did try this:
- $(CurrentTab)[0].addClass("selected");
But I get this error: Object doesn't support property or method 'addClass'