title: add jquery tab dynamically from another javascript
body: <p>I am using jQuery to create tabs. I put the javascript code in a separate file. tabset variable is used to reference the tab. Javascript has the following content:</p>
  
  <pre><code>$(document).ready(function() {
  //add a tabset
  var tabset = $("#tabset").tabs({
      /*add close button*/
      tabTemplate: "&lt;li&gt;&lt;a href='#{href}'&gt;#{label}&lt;/a&gt; &lt;span class='ui-icon ui-icon-close'&gt;Remove Tab&lt;/span&gt;&lt;/li&gt;",
      /*cache tabs*/
      cache: true,
      /*immediately select a just added tab*/
      add: function(event, ui) {
          //alert(ui.panel.id);
          tabset.tabs('select', '#' + ui.panel.id);
      }
  });
  </code></pre>
  
  <p>I could add another tab with the statement below. This works fine if I call this statement from this javascript.</p>
  
  <pre><code>tabset.tabs('add', url, nameToCheck);
  </code></pre>
  
  <p>I would like to add a new tab to the tabset called #tabset from another javascript file where I could not use tabset variable because it is out of scope.</p>
  
  <p>I try to use jquery selector to find tabset and call add function but the tab is not added. Please check the statement below:</p>
  
  <pre><code>$('#tabset').tabs('add', 'url', 'newTab');
  </code></pre>
  
  <p>My question is: how to add another tab to existing tabset from any javascript file? How to select an existing tabset and to call an add function?</p>
  
  <p>Best regards,
  Javanus</p>