You have to change:
if (event.target == modal_keyboard)
to:
if (event.target == modal_keyboard_archive)
Also look at my latest code ( https://flows.nodered.org/flow/7fb5bc5ae66e6bc1b1c1b8e800bdef51 ), you'll need to add: input.change() after a key and backspace event
type: function (key) {
var input = this.settings.input,
val = input.val(),
input_node = input.get(0),
start = input_node.selectionStart,
end = input_node.selectionEnd;
var max_length = $(input).attr("maxlength");
if (start == end && end == val.length) {
if (!max_length || val.length < max_length) {
input.val(val + key);
input.change()
}
} else {
var new_string = this.insertToString(start, end, val, key);
input.val(new_string);
start++;
end = start;
input_node.setSelectionRange(start, end);
}
input.trigger('focus');
if (shift && !capslock) {
this.toggleShiftOff();
}
},
backspace: function () {
var input = this.settings.input,
val = input.val();
input.val(val.substr(0, val.length - 1));
input.change()
},