title: Highlight current page in jquery
body: <p>I have the 12 html pages. and all this pages are loads when the left navigation bar link clicked. in this, i need to add a class to the current link, which is clicked and loaded the page. i tried with this: </p>
  
  <pre><code>$(function(){
      $('#container li a').click(function(){
          $('#container li a').removeClass('current');
          var pathname = (window.location.pathname.match(/[^\/]+$/)[0]);
          var currentPage = $(this).attr('href');
  
          if(currentPage==pathname){
              $(this).addClass('current');
          }
          else{
              alert('wrong');
          }
  
         // alert(pathname+' currentPage: '+currentPage);
  
      })
  })
  </code></pre>
  
  <p>it works, but on page load, the class is removed, i don't know why it's happening..</p>
  
  <p>any help?</p>