Skip to content


How to recognize the key being pressed? #127

callmesusheel opened this Issue · 2 comments

2 participants


I want to run custom piece of code on click of each button. I can use the "change" callback provided. However I'm confused as to how to parse the input object that it returns. I need the value of the button clicked.

Please help me with this.


In version 1.16, I added a lastKey value to the API.

You can access it at any time as follows:

api  = $('#keyboard').data('keyboard');
key = api.lastKey;

or access it within a callback

$('#keyboard').bind('change.keyboard', function(e, api){
    if (api) {
        key = api.lastKey;
        // do something with the key

if the virtual keyboard was used to enter the key, then api.$lastKey will contain the jQuery object of the button that was clicked.


I'm guessing this issue/question has been resolved, so I'm closing it. Please feel free to leave additional comments if you continue to have problems.

@Mottie Mottie closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.