1

I'm wondering how to remove the selected class of the all a element of the list ? I tried

$("#navigation li a").removeClass("selected");

but it seems not to be working.

        $('#navigation li').hover(function () {
            $(this).css('cursor', 'pointer');
        }, function () {
            $(this).css('cursor', 'auto');
        });

        <ul id="navigation">
            <li class="home"><a class="selected"></a></li>
            <li class="about"><a>text1</a></li>
            <li class="services"><a>text2</a></li>
            <li class="portfolio"><a>text3</a></li>
            <li class="contact"><a>text4</a></li>
        </ul>

3 Answers 3

3

Make sure you have jquery setup correctly your example seems to be working. I setup a fiddle and it works fine: http://jsfiddle.net/kpDTV/

Sign up to request clarification or add additional context in comments.

Comments

0

Your code is removing the selected class from the li you hover over, rather than the a within.

Comments

0

It seems to be working: http://jsfiddle.net/eG8ZS/

Maybe another part of script is not working?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.