Last active
January 2, 2016 09:39
-
-
Save johntron/8284931 to your computer and use it in GitHub Desktop.
This code should update the <div> with the value the user entered when "update" is clicked, but it does not. Why, and how do you fix this? Assume you cannot change the show() function.
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"></div> | |
<input type="text" /><button class="update">update</button> | |
<script type="text/javascript"> | |
var $number = document.querySelector('.number'); | |
var $input = document.querySelector('input'); | |
function show() { | |
$number.innerHTML = this.value; | |
} | |
document.querySelector('button').onclick = show; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment