JSFiddle - React, Tailwind, and code Playground

JavaScript

(function( ) {
    var loaded = 0, //scripts loaded
        needed = 2, // scripts to load
        checkReady = function () {
          this.onload = null;
          loaded++;
          if(loaded !== needed) {
            return;
          }
            
          $(function () {
            // things to happen when both scripts and the containing page
            $('body').html('test page');
          });
      }
    
    var headID = document.getElementsByTagName("head")[0];         
    var newScript = document.createElement('script');
    newScript.type = 'text/javascript';
    newScript.id = 'myjQuery';
    newScript.onload = checkReady;
    newScript.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
    headID.appendChild(newScript);

    newScript = document.createElement('script');
    newScript.type = 'text/javascript';
    newScript.id = 'myjQuery2';
    newScript.onload = checkReady;
    newScript.src = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js';
    headID.appendChild(newScript);

    alert("first alert");
})( );