Answer: 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"); });
</script>
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