How to attach keypress event to an element in jquery ?

 Posted by Vivek.Ramapuram on 11/7/2014 | Category: jQuery Interview questions | Views: 911 | Points: 40

In jquery keypress() method can be used to attach keypress event to a html element.

Example :
<script type="text/javascript">

$("#txtKeyPress").keypress(function () { $("#div3").append(" | key PRESS event fired"); });

From the code when user press the key in the “txtKeyPress” textbox, “ | key PRESS event fired” text will be appended in the “div3” element.

Asked In: spotted while learning | Alert Moderator 

Comments or Responses

Login to post response