Quantcast
Channel: Rick Schott :: devlpr.net » jQuery
Viewing all articles
Browse latest Browse all 10

Cross browser keypress event handling

$
0
0

Running example on JSFiddle:

$(document).ready(function () {
    $("#TextBox1").live('keypress', function (e) {
        var kCode = e.keyCode || e.charCode; //cross browser check
        //Mozilla and Safari define e.charCode, while IE defines e.keyCode which returns the ASCII value
        if (kCode == 9) {
           $("#TextBox2").focus();
        }
    });
});

JavaScript Madness: Keyboard Events


Viewing all articles
Browse latest Browse all 10

Trending Articles