Search code examples
jquerynavigationtoggleclass

jQuery toggleClass() navigation not working


Here is my markup: http://jsfiddle.net/dF2bM/2/

.active
{
    background: #f4b436;
    border-radius: 3px;
    width: 85px;
    padding: 5px 0;
}

.active class should provide a yellow bg to the "li" selected on click, but it doesn't work.

I loosing my hope, so I'm asking for help.


Solution

  • $(document).ready(function(){
        $('li').click(function(){
            $(this).toggleClass('active');
        });// <== You are missing this line
    });
    

    here is jsFiddle