Skip to content

Instantly share code, notes, and snippets.

@srph
Created September 5, 2014 05:22
Show Gist options
  • Save srph/3ef2f80cd042b3d95672 to your computer and use it in GitHub Desktop.
Save srph/3ef2f80cd042b3d95672 to your computer and use it in GitHub Desktop.
transfer txtarea1 to txtarea2 basilio
<html>
<head>
<title>PAHIRAP!</title>
</head>
<body>
<form>
Enter Code Here!<br>
<textarea class="code_input" rows="30" cols="50" id="code_input">
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph</p>
</body>
</html>
</textarea>
<input class="submit" type="reset">
<button type="button" id="submitBtn">Submit</button>
Result:
<textarea class="code_output" name="areaCode" rows="30" cols="50" readonly id="code_output"></textarea>
</form>
<script type="text/javascript">
/**
*
*/
function transfer (input, output) {
var input = document.getElementById(input),
output = document.getElementById(output);
output.value = input.value;
}
var btn = document.getElementById('submitBtn');
btn.addEventListener('click', function(e) {
e.preventDefault();
transfer('code_input', 'code_output');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment