How to attach keydown event to an element in jquery?

 Posted by Vivek.Ramapuram on 11/5/2014 | Category: jQuery Interview questions | Views: 1848 | Points: 40
Answer:

Here in the script in coding we have to attach or we have to use keydown() method to keydown event to show the html element in jquery.
example:

<script type="text/javascript">

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

</script>


when user press any key in the “txtKeyPress” textbox, “ | key DOWN event fired” text will appended in the “div3” element from the above code


Asked In: spotted while learning | Alert Moderator 

Comments or Responses

Login to post response