Simple JS Live Code Execution
Here is a simple Web page that loads and executes JavaScript from a DIV in the browser. This is a very basic trial bit of code based on something Kyle Simpson (@getify on Twitter) suggested. Here it is:
<html>
<head>
<script>
function run(){
var scriptTag = document.createElement("script");
var inline = document.createTextNode( document.querySelector( "#code" ).innerText );
scriptTag.appendChild( inline );
document.body.appendChild( scriptTag );
}
</script>
</head>
<body>
<div id="code" style="width: 80%; height: 50%; border: 1px solid silver;" contenteditable="true">
</div>
<button type="button" onclick="run();">Run</button>
</body>
</html>