3

Currently trying to focus on an input type when the AJAX method went successful. It works, but on Android it opens the virtual keyboard. As we are working on a PDA with a keyboard, I would like to hide that virtual keyboard.

On success

var inp = "$('artikeltje')"
hideKeyboard(inp);
document.getElementById("artikeltje").focus();

the function hideKeyBoard

function hideKeyboard(element) {
    element.attr('readonly', 'readonly'); // Force keyboard to hide on input field.
    element.attr('disabled', 'true'); // Force keyboard to hide on textarea field.
    setTimeout(function () {
        element.blur();  //actually close the keyboard
        // Remove readonly attribute after keyboard is hidden.
        element.removeAttr('readonly');
        element.removeAttr('disabled');
    }, 100);
}

Which was taken from this question: https://stackoverflow.com/a/11160055/7639883

Also: I have tried to set the focus first and then apply the hideKeyboard() without luck!

Falcon
  • 715
  • 7
  • 24

0 Answers0