Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active October 24, 2018 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/d9399ee98c60b40a7ed06f8572fac5ed to your computer and use it in GitHub Desktop.
Save bjoerntx/d9399ee98c60b40a7ed06f8572fac5ed to your computer and use it in GitHub Desktop.
window.onload = function () {
// attach keyDown event
document.addEventListener("keydown", keyDownHandler, false);
};
function keyDownHandler(e) {
var keyCode = e.keyCode;
// set fields to editable
TXTextControl.textFieldsEditable = true;
// if DELETE or BACKSPACE
if (keyCode == 8 || keyCode == 46) {
TXTextControl.getTextFields(function (e) { // get field at input positions
if (typeof e !== 'undefined' && e.length > 0) { // if array is defined
// remove the field at the input position
TXTextControl.removeTextField(e[0], false);
}
}, true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment