$(this) not working boolean in giving always false. Not able to add class : Hello people here is my code below..  
  <head>
            <title>Dwarka</title>  
            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
           <link href="webjars/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
           <script type="text/javascript" src="webjars/bootstrap/3.2.0/js/bootstrap.js"></script>
            <!--<link rel="stylesheet" type="text/css" href="Dwarka/src/main/resources/css/restaurantstyles.css">-->
            <link rel="stylesheet" href="resources/css/styles.css">
            <script>
           $(document).ready(function() {
            $('#somebutton').click(function(event) {
                    var name = $('#userName').val();
                    $.post('FirstServlet', {
                            userName : 'name'
                    }, function(responseText) {
                            $('#somediv').text(responseText);
                    });
            });
    });
    $(document).ready(function(){
      $(this).click(function(){ 
          alert($(this).parent().hasClass('active'));
    $('#tab').removeClass('active');
    $ (this).addClass('active');
    });
      });
        </script>
     </head>  
    <body>
      <div class="header">
      <a id="tab" href="#default" class="logo">CompanyLogo</a>
      <div class="header-right">
          <a id="tab" class="active" href="#home"><span id="tab">Home</span></a>
        <a id="tab" href="#contact">Contact</a>
        <a id="tab" href="#about">About</a>
      </div>
    </div>
          <button id="somebutton">press here</button>
        <div id="somediv"> </div>
    </body>