-
-
Save panesofglass/332170 to your computer and use it in GitHub Desktop.
mattpodwysocki: Quick letter counter from FlapJax demos to RxJS and jQUery
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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" > | |
<head> | |
<title>Letter Count</title> | |
<link rel="stylesheet" href="demo.css"/> | |
<style type="text/css"> | |
body {text-align: center; | |
background-color: #CCFFCC; | |
color: #006600;} | |
</style> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<script src="rx.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$("#toCount") | |
.ToObservable("keyup") | |
.Subscribe(function(event) { | |
$("#result").html("length: " + $("#toCount").val().length); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<p>Text buffer: <input type="text" id="toCount"></p> | |
<p id="result">Start Typing!</p> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment