Z.Keyboard

Inherits from Z.Base

Description

Due to incompatibilities between Android software keyboards from different vendors and the inability to detect autocomplete text on iOS, we strongly recommend the use of Z.Prompt over Z.Keyboard.

The Z.Keyboard object captures key presses and shows the device's on-screen keyboard (if appropriate).

For more information about accepting keyboard entry from a user see Getting Keyboard Input.

Example

var mykeyboard = Z.Keyboard();

mykeyboard.on("key", function(key) {
  if (key === "\n") {
    console.log("They pressed return!");
    mykeyboard.hide();
  } else {
    console.log("They pressed: " + key);
  }
});

mykeyboard.on("backspace", function() {
  console.log("They pressed backspace!");
});

mykeyboard.show();

Provided by Z.Keyboard

Constructor

Z.Keyboard( ) Constructs a new Z.Keyboard object.

Events

backspace Emitted if the user presses the backspace button on the keyboard.
key Emitted when the user enters a key on the keyboard.

Functions

hide( ) Hides the on-screen keyboard (if appropriate) and stops listening for key presses.
show( ) Displays the on-screen keyboard (if appropriate) and starts listening for key presses.

Inherited from Z.Base

Functions

emit(...) Calls the handler functions attached to an event.
hasTag(...) Returns true if this object has the specified tag.
off(...) Removes a handler function from an event.
on(...) Attaches a handler function to an event.
one(...) Attaches a single-use handler function to an event.
pushTag(...) Adds a tag to this object.
removeTag(...) Removes a tag from this object.
tags( ) Gets an array of the tags that this object belongs to.
tags(...) Sets the array of the tags that this object belongs to.
zapcode branded_zapcode i