Mottie's Virtual Keyboard: direct input
Asked Answered
S

1

5

There is an excellent jQuery on-screen keyboard plugin by Mottie: https://github.com/Mottie/Keyboard

By default text from the keyboard goes into additional input and then can be accepted or cancelled. If text is accepted it goes into the source textarea/input.

But is there a way to input directly from the keyboard to the source textarea/input without the need to accept it (like with mobile keyboards on android/ios)?

Slayton answered 8/5, 2014 at 10:2 Comment(0)
O
8

The documentation for the plugin is contained in GitHub wiki pages.

The option needed not include a preview is called usePreview (ref); set it to false (demo):

To autoaccept the contents, set the autoAccept option to true

$('#keyboard').keyboard({
    layout: 'qwerty',

    // true: preview added above keyboard;
    // false: original input/textarea used
    usePreview: false

    // Auto-accept content when clicking outside the
    // keyboard (popup will close)
    autoAccept: true

});
Opinionative answered 8/5, 2014 at 11:59 Comment(3)
Thanks! I can't get how I missed this one)Slayton
If this is for android, you might need to set the lockInput option to true making the input readonly (ref) and thus preventing the mobile keyboard from opening.Opinionative
Hello @Mottie, If I use these settings then its not working. I have to use alwaysOpen bit to true but autoAccept is not working with that. { $('#keyboard').keyboard({ layout: 'qwerty', alwaysOpen: true, usePreview : false, autoAccept : true, appendLocally: true }).addTyping(); }; }Laird

© 2022 - 2024 — McMap. All rights reserved.