Prev Demo
jQuery
>
.Keypress() - Attach Keypress Event To Element
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <input type="text" id="txtKeyPress" /> <div id="div3"></div> <script> $("#txtKeyPress").keypress(function () { $("#div3").append(" | key PRESS event fired"); }); $("#txtKeyPress").keydown(function () { $("#div3").append(" | key DOWN event fired"); }); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output