title: Replace class of a div using removeClass and addClass
body: <p>For my new wordpress site I need some help. I got 4 pages and 2 different sidebars. On 2 pages there shouldn't be a <code>border-left</code> and on the other 2 pages there should be a <code>border-left</code>. So I got following code:</p>
  
  <pre><code>&lt;div id="sidebar" class="sidebar"&gt;
          &lt;?php if(is_page('Willkommen') || is_page('Angebot'))
              {
                  dynamic_sidebar('Angebot');
              }
  
              else
              {
                  dynamic_sidebar('Anfahrt');
                  if(is_page('Anfahrt'))
                  {
                      echo "&lt;script type='text/javascript'&gt;
  function removeBorder()
  {
      $(document).ready(function() {
          if($('#sidebar').hasClass('sidebar'))
          {
              $(this).removeClass('sidebar')
              $(this).addClass('secondsidebar')
          }
  
      });
  }
  &lt;/script&gt;";
                  }
              }
          ?&gt;
      &lt;/div&gt;&lt;!-- sidebar --&gt;
  </code></pre>
  
  <p>I want to remove the class "sidebar" and add the class "secondsidebar" if there is a <code>div#sidebar</code> on the page. But the code won't work. I wrote this code for myself and I'm a beginner in jQuery :) So please be patient.</p>
  
  <p>I hope someone can give me a hint.</p>
  
  <p>Cheers</p>