JSFiddle - React, Tailwind, and code Playground

HTML

<script type="valid-javascript">console.log("me");</script>
<script type="invalid-javascript">some}invalid{code}{here} </script>
<button>clickme</button>
<button>clickmenot</button>
<button>load jQuery</button>
<button>check jQuery</button>

JavaScript

document.getElementsByTagName("button")[0].onclick = function() { eval(document.getElementsByTagName("script")[2].innerText); };
document.getElementsByTagName("button")[1].onclick = function() { eval(document.getElementsByTagName("script")[3].innerText); };


document.getElementsByTagName("button")[2].onclick = function() {
    var scriptTag = document.createElement("script");
    scriptTag.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js";
    document.getElementsByTagName("head")[0].appendChild(scriptTag);
}
document.getElementsByTagName("button")[3].onclick = function() {
    console.log(typeof $ === 'undefined');
}