Skip to content

Z.Keyboard

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.

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();