Salman
Salman

Reputation: 3207

Is there a way to hide iPad keyboard on safari (web browsers)

Is there a way (jquery/javascript/css) to stop iPad keyboard popping up every time we focus on an input field. Idea here is to use on screen keyboards instead (like http://mottie.github.io/Keyboard/mobile.html) as the iPad's keyboard takes almost half of the screen and this isnt required.

Upvotes: 1

Views: 482

Answers (1)

urbz
urbz

Reputation: 2667

You could define a variable hideKeyboard and call it whenever you need it:

var hideKeyboard = function () {
    document.activeElement.blur();
    $("input").blur();
};

Reference:

You could go with a plain Javascript alternative:

var hideKeyboard = function() {
 document.activeElement.blur();
 var inputs = document.querySelectorAll('input');
 for(var i=0; i < inputs.length; i++) {
  inputs[i].blur();
 }
};

Upvotes: 1

Related Questions