Created
November 17, 2014 08:58
-
-
Save nitish1402/1efb2ca34aabaae400e8 to your computer and use it in GitHub Desktop.
Basic example of binding data to an input in jQuery // source http://jsbin.com/julav
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 name="your-name" id="your-name" type="text"></input> | |
</div> | |
<div id="output">Hello</div> | |
<script id="jsbin-javascript"> | |
$('#your-name').bind('input', function() { | |
var name = $(this).val(); | |
// now you can use "name" here | |
$('#output').html("Hello " + name); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">$('#your-name').bind('input', function() { | |
var name = $(this).val(); | |
// now you can use "name" here | |
$('#output').html("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
$('#your-name').bind('input', function() { | |
var name = $(this).val(); | |
// now you can use "name" here | |
$('#output').html("Hello " + name); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment