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.

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

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: 1027 | Post Order: 73

Write for us