Created
January 9, 2015 18:39
-
-
Save anonymous/3cc191216a8194d3fc24 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/yetuluvape
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
body { | |
text-align: center; | |
font-family: Arial; | |
padding-top: 40px; | |
} | |
</style> | |
</head> | |
<body> | |
<p>Example text #1 <button>ONE</button></p> | |
<p>Example text #2 <button>TWO</button></p> | |
<script id="jsbin-javascript"> | |
var pars = document.querySelectorAll('p'), | |
btns = document.querySelectorAll('button'), | |
text; | |
btns[0].addEventListener('click', function () { | |
text = pars[0].firstChild; | |
text.appendData('TEXT ONE ADDED '); | |
}, false); | |
btns[1].addEventListener('click', function () { | |
text = pars[1].firstChild; | |
text.appendData('TEXT TWO ADDED '); | |
}, false); | |
</script> | |
<script id="jsbin-source-css" type="text/css">body { | |
text-align: center; | |
font-family: Arial; | |
padding-top: 40px; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var pars = document.querySelectorAll('p'), | |
btns = document.querySelectorAll('button'), | |
text; | |
btns[0].addEventListener('click', function () { | |
text = pars[0].firstChild; | |
text.appendData('TEXT ONE ADDED '); | |
}, false); | |
btns[1].addEventListener('click', function () { | |
text = pars[1].firstChild; | |
text.appendData('TEXT TWO ADDED '); | |
}, false); | |
</script></body> | |
</html> |
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
body { | |
text-align: center; | |
font-family: Arial; | |
padding-top: 40px; | |
} |
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 pars = document.querySelectorAll('p'), | |
btns = document.querySelectorAll('button'), | |
text; | |
btns[0].addEventListener('click', function () { | |
text = pars[0].firstChild; | |
text.appendData('TEXT ONE ADDED '); | |
}, false); | |
btns[1].addEventListener('click', function () { | |
text = pars[1].firstChild; | |
text.appendData('TEXT TWO ADDED '); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment