title: $(this).dialog is not a function
body: <p>...or Why <code>$(this).dialog()</code> fails in Firefox when using dynamic HTML?</p>
  
  <p>I have a a click event that opens a jQuery modal dialog box on a web page, and it is working fine in Chrome and IE, but not in Firefox.</p>
  
  <p>Here is the pertinent code:</p>
  
  <pre><code>var dialogId = 'uniqueName-' + Math.floor(Math.random() * 1000)
  var dialogDiv = $(document.createElement('div')).attr("id", dialogId);
  
  dialogDiv.load(this.href, function () {
      var dialog = $(this).dialog({ autoOpen: false });
      ...
  });
  </code></pre>
  
  <p>In Firefox 11, <code>$(this).dialog({ autoOpen: false })</code> fails with the following error message:</p>
  
  <blockquote>
    <p>$(this).dialog is not a function</p>
  </blockquote>
  
  <p>But in IE 9 an Chrome 17 everything is working fine. Any clue why that is?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Here is my <code>document.ready</code> function where the code above was. I removed it to simplify things. ALERT A is occuring before ALERT B. ALERT A says <code>[object Object]</code>. ALERT B occurs when I click on a link and it says <code>'undefined'</code>.</p>
  
  <pre><code>$(function () {
  
      alert($.ui);    // ALERT A
  
      // Wire up the click event of any dialog links
      $('.dialogLink').live('click', function () {
          alert($.ui);    // ALERT B
          return false;
      });
  });
  </code></pre>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>Now that I pin pointed where the problem was coming from I rephrased my question and posted the minimal code to reproduce the original problem here: <a href="https://stackoverflow.com/questions/9900989/why-is-ff-loosing-jquery-ui-in-click-event-handler">Why is FF on OS X losing jQuery-UI in click event handler?</a></p>