Skip to content
Rob Garrison edited this page Apr 18, 2016 · 11 revisions

Sections: Get keyboard Object | Open keyboard | Add Content | Simulate Typing | Enable/Disable

Get the keyboard object

The following methods are equivalent:

var keyboard = $('#keyboard').getkeyboard();
var keyboard = $('#keyboard').data('keyboard');

The examples below use the following button HTML

<button class="open">Open Keyboard</button>

Open the keyboard

Open the keyboard by clicking on a button:

$('button.open').click(function(){
  $('#keyboard').getkeyboard().reveal();
});

Open keyboard, then immediately add content

$('button.open').click(function(){
  var keyboard = $('#keyboard').getkeyboard();
  keyboard
    .reveal()
    .insertText('Hello, my name is Inigo Montoya. You killed my father, prepare to die!');
});

Open keyboard, then simulate typing in content

This needs the typing extension loaded and initialized - see the Setup page for more details.

$('button.open').click(function(){
  var keyboard = $('#keyboard').getkeyboard();
  keyboard
    .reveal()
    .typeIn('As you wish!', 500, function(kb) {
      // do something after text is added (kb = keyboard)
      // kb.accept(); // close keyboard and accept changes
    });
});

Dynamically enable or disable the keyboard keys & input

Add a {toggle} button to your keyboard, or if your keyboard is always open, you can add an external button to toggle the keyboard state:

$('button.toggle').click(function(){
  var keyboard = $('#keyboard').getkeyboard();
  // if keyboard.enable = false, all keys & preview will be disabled
  keyboard.enable = !keyboard.enable;
  keyboard.toggle();
});

Wiki Pages: Home | FAQ | Setup | Usage | Options ( Layout, Language, Usability, Actions ) | Methods | Theme | Log

Clone this wiki locally