Handle input key up event

Description

The following code shows how to handle input key up event.

Example


<html>
<head>
<script type="text/javascript"
  src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
  $(document).ready(function() {<!--from   ww w  .  j  av a 2  s .  c  o m-->
    $("input").keyup(function() {
      var value = $(this).val();
      $("p").text(value);
    }).keyup();
  });
</script>
<style>
.selected {
  color: red;
}

.highlight {
  background: yellow;
}
</style>
</head>
<body>
  <input type="text" value="some text" />
  <p></p>
</body>
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Example »




Animation
DOM
Event
Form
List
Select
Style
Table
Utilities