Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.77k stars 722 forks source link

again: Open Keyboard programmatically #790

Open xalexbo opened 4 years ago

xalexbo commented 4 years ago

key_alfa.txt

Hi Mottie, long post: I have a web page with a text field which is usually filled by a barcode reader, but I want to give choice to use a custom alpha keyboard, to be shown on request clicking a button. Keyboard layout javascript lies on a .js file which is loaded on top of webpage - see attached file. Following event doesn't work: $('#icon').click(function() { var kb = $('#alfa).getkeyboard(); kb.reveal(); }); debugger says "kb is undefined" and thus keyboard does not appear, looking at source page I saw keyboard layout js script is properly loaded and available. Where am I wrong? Can you help me to make it work? Another acceptable solution could be having both keyboard shown and text field being editable to allow barcode reader filling the field: do you have any clue on this matter? Thanks ! Alex

Mottie commented 4 years ago

Hi @xalexbo!

Using getkeyboard only works after the keyboard has been initialized. Please make sure to initialize it, and set the openOn option to an empty string - this prevents the keyboard from opening on focus.