Count keyup times
Description
The following code shows how to count keyup times.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.css">
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!-- w w w . j av a2 s .c o m-->
var counter = -1;
$(window).on("pageshow", function() {
increaseCounter();
$("#textinput").on("keyup", function(event) {
increaseCounter();
})
});
function increaseCounter() {
counter++;
$("#counter").html(counter);
}
});//]]>
</script>
</head>
<body>
<div data-role="page" id="bar">
<div data-role="header">
<h3>Header</h3>
</div>
<div data-role="content">
<label for="basic">Text Input:</label>
<input type="text" name="name"
id="textinput" value="" />
<span id="counter"></span>
</div>
<!-- /content -->
</div>
<!-- /page -->
</body>
</html>