title: Bootstrap data-toggle="tab" calling in a Javascript function
body: <p>I have a little problem with some JavaScript code that I fail to call in a function. The code is:</p>
  
  <pre class="lang-js prettyprint-override"><code>$('#myTabs a[href="#name"]').tab('show');
  </code></pre>
  
  <p>It works if it is not called in a function. This is supposed to toggle tabs working with Bootstrap framework. Does anyone know how to make it compatible to call in a function?</p>
  
  <p>Edit:</p>
  
  <pre><code>function switch_tab()
  {
     $('#tablist a[href="#tab_default_2"]').tab('show');
  }
  </code></pre>
  
  <p>Does not work while it does work without function. (I'm not good in JavaScript, so if it's obvious, I may not have seen it).</p>