<textarea></textarea><br> <button>Go</button> <script> var t = document.querySelector("textarea"), b = document.querySelector("button") ; b.onclick = function() { window.eval(t.value) ; } ; </script>