title: Bootstrap tab activation with JQuery
body: <p>I have the following code:</p>
  <pre><code>&lt;ul class=&quot;nav nav-tabs&quot;&gt;
      &lt;li&gt;&lt;a href=&quot;#aaa&quot; data-toggle=&quot;tab&quot;&gt;AAA&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#bbb&quot; data-toggle=&quot;tab&quot;&gt;BBB&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ccc&quot; data-toggle=&quot;tab&quot;&gt;CCC&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;div class=&quot;tab-content&quot; id=&quot;tabs&quot;&gt;
      &lt;div class=&quot;tab-pane&quot; id=&quot;aaa&quot;&gt;...Content...&lt;/div&gt;
      &lt;div class=&quot;tab-pane&quot; id=&quot;bbb&quot;&gt;...Content...&lt;/div&gt;
      &lt;div class=&quot;tab-pane&quot; id=&quot;ccc&quot;&gt;...Content...&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>And the following script:</p>
  <pre><code>$(document).ready(function(){
      activaTab('aaa');
  });
  
  function activaTab(tab){
      $('.tab-pane a[href=&quot;#' + tab + '&quot;]').tab('show');
  };
  </code></pre>
  <p>In this case when the page is ready, the second tab will be activated but I always get a JavaScript error in the line <code>$('.tab-pane a[href=&quot;#' + tab + '&quot;]').tab();</code></p>
  <p>Can anyone help me, please?</p>