Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to recognize the key being pressed? #127

Closed
susheelsk opened this issue Dec 2, 2012 · 2 comments
Closed

How to recognize the key being pressed? #127

susheelsk opened this issue Dec 2, 2012 · 2 comments

Comments

@susheelsk
Copy link

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.

@Mottie
Copy link
Owner

Mottie commented Dec 13, 2012

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.

@Mottie
Copy link
Owner

Mottie commented May 6, 2013

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 as completed May 6, 2013
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants