Created
February 28, 2018 01:58
-
-
Save Blainegunn/90deb788458d3714230e1bf7a9ca412f to your computer and use it in GitHub Desktop.
Calculator Exam
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
<div class="number">1</div> | |
<div class="number">2</div> | |
<div class="number">3</div> | |
<div class="number">4</div> | |
<div class="number">5</div> | |
<div class="number">6</div> | |
<script type="text/javascript"> | |
var numbers = document.querySelectorAll('.number') | |
Array.from(numbers).forEach(function(element){ | |
element.addEventListener('click', function(){ | |
console.log(element.textContent); | |
}) | |
}) | |
</script> | |
<style media="screen"> | |
.number { | |
display: inline-block; | |
width: 30%; | |
background: grey; | |
color: orange; | |
font-size: 50px; | |
border-radius: 15px; | |
margin: 5px; | |
text-align: center; | |
} | |
body { | |
text-align: center; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment