JSFiddle - React, Tailwind, and code Playground

by Gerald Gillespie

HTML

<div>hi</div>

JavaScript

javascript: (function(){  
    function loadScript(u, c) {
        var s = document.createElement("script");
        s.type = "text/javascript";
        if (s.readyState) {
            s.onreadystatechange = function () {
                if (s.readyState == "loaded" || s.readyState == "complete") {
                    s.onreadystatechange = null;
                    c();
                }
            };
        } else { //Others
            s.onload = function () {
                c();
            };
        }
        s.src = u;
        document.getElementsByTagName("head")[0].appendChild(s);
    }
    var x=function(){
     // my code
         var m = ($===jQuery) ? '$' : '$j',
            s= prompt('Scriptname','https://support.kace.com/jkuery/www/js/test.js');
            console.log(s);
        jQuery.getScript(s,function(){
            console.log('you jquery script is loaded successfully');
        }).done(function(){
            //alert('done');
        }).fail(function(jqxhr, settings, exception){
            alert('script failed to load: '+exception);
            console.log('script failed to load: '+exception);
        });
    };
    if (typeof jQuery == 'undefined') {
        var n = (typeof $ != 'undefined')? 'window.$j = jQuery.noConflict();' : '',
        u=prompt('Google%20jQuery? (or custom URL)','http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js');
        if(u != null){
            loadScript(u, function () {
                console.log('hi');
                eval(n);
                x();
            });
        } else {
            alert('no jquery will be loaded');
        }
    } else {
        x();
    }
})();