Created
November 26, 2013 02:27
-
-
Save nola/7652582 to your computer and use it in GitHub Desktop.
$(“#name”) tells jQuery to deal with element id=’name’.
.keyup(updateName) calls jQuery keyup method and tells it to run updateName function whenever it detects keystroke on #name element.
The first line of updateName() function makes use of jQuery val() method to read the current value of #name input. It will then store that value inside ‘name’…
This file contains hidden or 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
| $("#name").keyup(updateName) | |
| function updateName() { | |
| var name=$("#name").val(); | |
| $("#user-name").text(name); | |
| } |
This file contains hidden or 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
| <input id="name" placeholder='Type your name'> | |
| <h2>Welcome </h2> | |
| <h2 id="user-name"></h2> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment