I am trying to load a chunk of html into my div and I am running into some issues with the javascript inside the html string only loading up about 50% of the time.

I am aware that I can use jQuery's:
 `$(div).html(htmlString);`
to load the html into the necessary div. The html causing the issue is done in a document ready block and I am curious if when using the .html(..) if the document ready code is executed because the page as a whole is ready while the loaded html inside of the (primarily the jquery-ui js) may not be??

```
<html>
   <head>
     <script src="..../jquery-ui.min.js"></script>
     <script type="text/javascript"> $(function() {  $("#tabs").tabs(); }); </script>
   </head>
   <body>
      <div>......</div>
   </body>
</html>

```

I have tried to apply a timeout in the added html to try and add time for the jquery-ui script to load:

```
$(function(){  setTimeout(function(){ $("#tabs").tabs(); }, 300); });

```

but this is still not 100% reliable since the time required to load the necessary javascript can vary. Is there a way to ensure the loaded html's document ready state has waited until the jquery ui script has loaded?