Skip to content

Instantly share code, notes, and snippets.

@ecaepsey
Created March 19, 2020 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecaepsey/1855541d7d55ca5a20ba72cbd9449f22 to your computer and use it in GitHub Desktop.
Save ecaepsey/1855541d7d55ca5a20ba72cbd9449f22 to your computer and use it in GitHub Desktop.
simpleApp
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="result">
</div>
<button id="increment">+</button>
<button id="decrement">-</button>
<script>
function app() {
var counterValue = 0;
var result = document.getElementById('result');
var inc = document.getElementById('increment');
var dec = document.getElementById('decrement');
document.getElementById('increment');
inc.addEventListener('click', function(e){
counterValue += 1;
result.textContent = counterValue
});
document.getElementById('decrement')
dec.addEventListener('click', function(e){
counterValue -= 1;
result.textContent = counterValue
})
result.textContent = counterValue
}
app()
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment