title: JQuery UI Buttons, Within jQuery UI tabs doesn't work after switching back and forth
body: <p>Beginner. I have some tabs, and for each tab content is dynamically loaded from text file kinda thing. So each tab is click, text file with content is loaded for that tab.</p>
  
  <pre><code>$('#thisMainTabs').tabs({selected:0});
  
  &lt;div id='thisMainTabs'&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;a href='/scripts/thisMainTabs1.txt'&gt;Tab 1 Content&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href='/scripts/thisMainTabs2.txt'&gt;Tab 2 Content&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href='/scripts/thisMainTabs3.txt'&gt;Tab 3 Content&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href='/scripts/thisMainTabs4.txt'&gt;Tab 4 Content&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href='/scripts/thisMainTabs5.txt'&gt;Tab 5 Content&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>as basic as it gets i suppose. In a few of these tabs I have jQuery buttons that are also very basic</p>
  
  <p>within the document ready:</p>
  
  <pre><code>$('#btnNumber1').button({icons: {primary: 'ui-icon-circle-plus' secondardy: null} });
  
  $('#btnNumber1').click(function () {
       alert('working');
  });
  
  
  &lt;div id='btnNumber1'&gt;add new&lt;div&gt;
  </code></pre>
  
  <p>so as an example i just used these alerts but actually these things open dialog (yeah jquery dialogs too). what seems to be happening is that each tab when selected the first time will render the button and it will work, but if I return to the tab, the button is there but doesn't do anything when clicked. not sure if its the dialogs or the buttons? but everything works the first time through.</p>
  
  <p>I am new so greatly appreciate any help with this. Thanks!</p>
  
  <p>EDIT: Should have clarified a few things a bit more. apologies.</p>
  
  <p>So the above .tabs() and #thisMainTabs is the only thing in the main page content. with the exception of the default tabs content...nothing but text really. in each of the other tabs (there are about 5 more) I have the href pointing at links to text files. Each one of these text files contains that tabs content (markups, js, css, etc) and in each one I have a $(document).ready....which is kinda of a weird idea, but with everything else it seems to work?? I will claim beginner once again :) . So I have accordions, I have buttons, I have dialogs (all jQ), and everything was working fine, until I noticed the above mentioned behaviour. If I select each tab the first time, the content loads, the button is there, I click it, and it works (most are dialogs). switch between tabs and aslong as its that tabs first time being clicked, they all work.</p>
  
  <p>However if I come back to a tab, the button is there, but does nothing.</p>
  
  <p>The one I have above is an example of how I am using all the buttons deeming them buttons and setting up the click functions. Each one of these is in the document ready for each text file for each tab. I have double and triple checked all ids to ensure everything is unique; went to the extreme with IDs to ensure this wouldn't happen since collectively its A LOT of script. to me anywany....</p>
  
  <p>UPDATE: Not sure if its the buttons or the dialogs I am having trouble with, the above mentioned problem seems to be isolated to those buttons that fire dialogs. Same thing though, first time fine, second time not so fine. Attached alerts to some and that works fine.</p>
  
  <p>dialogs are built like this (also inside the text file completely and on document ready of that text file).</p>
  
  <pre><code>$('#thisDialogDiv').dialog({ 
                          resizable:false, 
                          width:200, 
                          modal: true, 
                          autoOpen: false, 
                          buttons: { 
                          "Ok": function() { $(this).dialog("close"); } } 
                          }); //not bothering with buttons
  
  &lt;div id="thisDialogDiv"&gt;
  &lt;h3&gt;Here is the Title&lt;/h3&gt;
  &lt;p&gt;Here is some content on the dialog&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>on the buttons that are referenced above call the dialogs like this</p>
  
  <pre><code>$('#btnNumber1').click(function () {
      $('#thisDialogDiv').dialog("open");
  });
  </code></pre>
  
  <p>and that is basically it for each instance....pretty basic I guess. </p>