removeClass() doens't work

removeClass() doens't work

Hi,

I've made a very small jQuery script for a website Demo where one will click on a button in the top navigation.
As you can see the first anchor has a class called "active", this is added with the jquery.

So my goal is when a visitor clicks on another link the class on the "previous" button should be removed and added to the actual button.
This kinda works, but directly, see, the "new' active button receives the class active but the class isn't removed from the old one, strange thing is that the class is removed when you hover over.

Here's the script:

  1.         $(document).ready(function(){
  2.            
  3.                 $('.nav a:first').addClass("active");
  4.                                    
  5.                 $('.nav a').click(function(){
  6.                
  7.                     $('.nav li').removeClass("active");
  8.                     $(this).addClass("active");
  9.                     return false;
  10.                
  11.                 });
  12.            
  13.             });

Anyone knows how to solve this?