Reputation: 2379
I want to hide the keyboard on Focus(),but when $(".ui-input-text").focus();
it will automatically open the keyboard .
I just want to hide in particular screen ,I have test with document.activeElement.blur();
but it also did not focus() on input .
Upvotes: 8
Views: 23981
Reputation: 69
Is this oversimplifying? :
<input id="x" inputmode="none" value="x">
I tangled with scripts for hours, and found this was a simpler and more reliable way to hide the keyboard when the input was being used for other stuff.
Upvotes: 1
Reputation: 6942
From here
var hideKeyboard = function() {
document.activeElement.blur();
$("input").blur();
};
Edited : another option
$('.clr').after('
//<input tyep="checkbox"
<input type="checkbox"
id="focusable"
style="height:0;
margin- left:-200px;
clear:both;" />');
$('#focusable').focus(); `
Upvotes: 1
Reputation:
When submitting a form, at times, the iOS Keyboard may not automatically close. This is quite a usability issue as Users should not be required to manually close the Keyboard for use-cases in which they would otherwise not expect the need do so.
A simple solution for this can be implemented by invoking the blur method on document.activeElement, which effectively allows one to programmatically hide the keyboard:
// automatically close the keyboard on iOS
document.activeElement.blur();
More about HTML5 and Mobile application events ..
http://www.ericfeminella.com/blog/2012/12/27/ios-html5-input-element-tips/
Upvotes: 14
Reputation: 21531
Try this:
$('#yourElement').blur();
It will hide the virtual keyboard.
Upvotes: 1