title: Using external script inside load callback with dialog?
body: <p>I hope I can explain this properly. I am creating a JQuery dialogue box where the content is loaded from an HTML file. This dialogue box contains a form with which I need to perform additional JS functions. The problem I am running into, is that none of the HTML/selectors exist in the DOM until I click <code>#image_edit</code> so my JQuery upload script is not working.<br>
  As you can see, I am invoking the upload function on the <code>.load</code> callback, but it doesn't work. Is there a better/proper way to do this?</p>
  
  <p><strong>EDIT :</strong>
  After moving the <code>.dialog</code> and remote functions inside the <code>load()</code> callback, everything is working as expected.</p>
  
  <p><strong>uploadInterface.js</strong></p>
  
  <pre><code>(function($) {
      $(function(//removed, was not needed//) {
      //upload functions//
      });
  })(window.jQuery);
  </code></pre>
  
  <p><strong>uploadSetup.js</strong></p>
  
  <pre><code>(function($) {
      $(function(//removed, was not needed//) {
      //upload functions//
      });
  })(window.jQuery);
  </code></pre>
  
  <p><strong>dialogue.js</strong></p>
  
  <pre><code>$(function(){
      $('#image_edit').click(function() {
          $(".upload_div").load('../dialogues/content.html #upload_window', function() {
  
              $.getScript("js/uploadInterface.js"); //added remote script here//
              $.getScript("js/uploadSetup.js"); //added remote script here//
  
          }).fadeTo("slow", 1).dialog({
              title: "Upload an image",
              width: "320px",
              position: { my: 'top', at: 'top+150' },
              resizable: false,
              draggable: false,
              modal: true,
              show: "fadeIn",
              hide: "fadeOut",
              create: function(event, ui) {
                  var widget = $(this).dialog("widget");
                  $(".ui-dialog-titlebar-close span", widget)
                  .removeClass("ui-icon-closethick")
                  .addClass("ui-icon-close-custom");
              }
          });
      });
  });
  </code></pre>