Created
November 17, 2014 08:23
-
-
Save nitish1402/cfa725dbb37e57326b75 to your computer and use it in GitHub Desktop.
Basic example of binding data to an input in jQuery // source http://jsbin.com/kakaye
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> | |
<meta name="description" content="Basic example of binding data to an input in jQuery" /> | |
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<br/><br/> | |
<div> | |
Enter your name: | |
<input type="text" onkeyup="updateOutput(this)"></input> | |
</div> | |
<div id="output">Hello</div> | |
<script id="jsbin-javascript"> | |
function updateOutput(elem) { | |
var name = elem.value; | |
var outputElement = document.getElementById("output"); | |
outputElement.innerHTML = "Hello " + name; | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function updateOutput(elem) { | |
var name = elem.value; | |
var outputElement = document.getElementById("output"); | |
outputElement.innerHTML = "Hello " + name; | |
}</script></body> | |
</html> |
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
function updateOutput(elem) { | |
var name = elem.value; | |
var outputElement = document.getElementById("output"); | |
outputElement.innerHTML = "Hello " + name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment