jQuery > Events

Keydown Event in jQuery

How to attach keydown event to an html element in jQuery?


To attach keydown event to a html element, keydown() method can be used.

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

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

 Views: 6575 | Post Order: 73



Write for us






Hosting Recommendations