Permalink
Switch branches/tags
Nothing to show
Find file Copy path
627374f Jun 20, 2018
2 contributors

Users who have contributed to this file

@chrisdavidmills @bripmccann
26 lines (23 sloc) 668 Bytes
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Apply JavaScript example</title>
<script>
document.addEventListener("DOMContentLoaded", function() {
function createParagraph() {
var para = document.createElement('p');
para.textContent = 'You clicked the button!';
document.body.appendChild(para);
}
var buttons = document.querySelectorAll('button');
for(var i = 0; i < buttons.length ; i++) {
buttons[i].addEventListener('click', createParagraph);
}
});
</script>
</head>
<body>
<button>Click me</button>
</body>
</html>