Skip to content

Instantly share code, notes, and snippets.

@Haraldson
Created March 5, 2014 10:41
Show Gist options
  • Save Haraldson/9364940 to your computer and use it in GitHub Desktop.
Save Haraldson/9364940 to your computer and use it in GitHub Desktop.
Hide virtual keyboard on devices.
function hideVirtualKeyboard(os)
{
$('input, textarea').blur();
if(os === 'iOS')
document.activeElement.blur();
if(os === 'Android')
{
var $field = $('<input type="text">');
$('body').append($field);
window.setTimeout(function()
{
$field.focus();
window.setTimeout(function()
{
$field.hide();
}, 50);
}, 50);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment