About using jQuery's keyup () event

jQuery is a very good framework within the front end, we've come to receive what keyup event, look at the statement given by the official keyup event fires when the button is released. He said common point is that this event will finish when you press the keyboard to trigger this event

<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="js/jquery-1.11.0.js"></script>
		<script type="text/javascript">
				// The first way
				$(document).ready(
					function(){
					$("input").keyup(
						function(){
							$("input").css("background-color","red");
						});
				});
				// The second way
				$(document).ready(function(){
					$("#in").keyup(
						function(){
							$("input").css("background-color","greenyellow");
						}
					);
				});
				// third way
				$(document).ready(function(){
					$("#in").bind("keyup",function(){
						$("#in").css("background-color","red");
					});
				});
		</script>
	</head>
	<body>
		<input id="in" type="text"/>
	</body>
</html>

  

Guess you like

Origin www.cnblogs.com/tranquilityMan/p/11006804.html