JSFiddle - React, Tailwind, and code Playground

by Charles Wilkins IV

HTML

<div id="div1"></div>

JavaScript

function myJQueryCode() {
    $(document).ready(function () {
        $("#div1").replaceWith("JQuery is loaded"); 
    });
}

if(typeof jQuery=='undefined') {
    var headTag = document.getElementsByTagName("head")[0];
    var jqTag = document.createElement('script');
    jqTag.type = 'text/javascript';
    jqTag.src = '//code.jquery.com/jquery-2.0.3.min.js';
    jqTag.onload = myJQueryCode;
    headTag.appendChild(jqTag);
} else {
	alert('You are here')
	myJQueryCode();
}
function yourFunctionToRun(){
    //Your JQuery goodness here
}

function runYourFunctionWhenJQueryIsLoaded() {
    if (window.$){
        //possibly some other JQuery checks to make sure that everything is loaded here
        myJQueryCode();
    } else {
        setTimeout(function() {runYourFunctionWhenJQueryIsLoaded()}, 50);
    }
}

runYourFunctionWhenJQueryIsLoaded();
if(typeof jQuery=='undefined') {
	alert('Houston we have a problem');
}