Created
December 9, 2016 03:18
-
-
Save dengjonathan/04ac1be1a576f8566617ac2603a59627 to your computer and use it in GitHub Desktop.
Vanilla JS
This file contains 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> | |
<title>Vanilla JS MVC</title> | |
</head> | |
<body> | |
<div class="counter"> | |
<button id="up">+</button> | |
<p id="count">0</p> | |
<button id="down">-</button> | |
</div> | |
<script> | |
(function() { | |
const $count = document.getElementById('count'); | |
const $up = document.getElementById('up'); | |
const $down = document.getElementById('down'); | |
$up.onclick = () => $count.innerHTML = parseInt($count.innerHTML) + 1; | |
$down.onclick = () => $count.innerHTML = parseInt($count.innerHTML) - 1; | |
})() | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment