Jquery Keypress Event Example - Jquery

How to code for keypress event in jquery?

Snippet Code


  
Rate this page :
  [ 0 votes]

The simple jquery code allows you to monitor the count of keypress event.The sample jquery code for keypress event is given below.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> i = 0; $(document).ready(function(){ $("input").keypress(function(){ $("span").text(i += 1); }); }); </script> Enter text here: <input type="text"> <p>Keypress Count: <span>0</span></p>

Tags


Ask Questions

Ask Question