Last active
July 2, 2016 10:56
-
-
Save psycalc/6d7832bdc9d185f9fd0efb9e8c9bade4 to your computer and use it in GitHub Desktop.
Covert string to code that can be performed (invoked, run, call and so on)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- need bootstrap.css for quick start --> | |
<div class="container"> | |
<h2>Form control: textarea</h2> | |
<p>The form below contains a textarea for comments:</p> | |
<form role="form"> | |
<div class="form-group"> | |
<label for="comment">Comment:</label> | |
<textarea class="form-control" rows="5" id="comment"></textarea> | |
<button type="button" class="btn btn-default">Default</button> | |
</div> | |
</form> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var textarea = document.getElementsByTagName("textarea")[0]; | |
textarea.value = "Hello World"; | |
var button = document.getElementsByTagName("button")[0]; | |
button.addEventListener("click", function () { | |
(new Function(textarea.value))(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment