JQuery Keypress And Detect Character Code

March 2nd, 2011 by aditia rahman / 1 Comment  


In this sort post I want to share how to detect keyboard input character using jquery, basically this is very simple cause JQuery have already built in keypress() event, we just need to get the callback parameter properties, let get through the code

$(document).ready(function() {
    $("#field").keypress(function(event) {

The code above used to get the character code from the input keyboard, you can browse more the “event” callback parameter using console.log() function and browse the entire parameter properties using firebug in firefox or inspect element console in webkit browser,


and to convert back to character, simply using this javascript code.


View Demo

        submit to reddit Delicious

One Comment Leave a Comment Subscribe RSS

Leave a Comment