我想隐藏Focus()上的键盘,但当$(".ui-input-text").focus();
时,它会自动打开键盘。
我只想隐藏在特定的屏幕上,我用document.activeElement.blur();
进行了测试但它也没有关注输入()。
提交表单时,iOS键盘有时可能不会自动关闭。这是一个可用性问题,因为用户不应该被要求手动关闭键盘,否则他们不会期望这样做
一个简单的解决方案可以通过调用document.activeElement上的blur方法来实现,该方法有效地允许以编程方式隐藏键盘:
// automatically close the keyboard on iOS
document.activeElement.blur();
有关HTML5和移动应用程序事件的更多信息。。
http://www.ericfeminella.com/blog/2012/12/27/ios-html5-input-element-tips/
试试这个:
$('#yourElement').blur();
它将隐藏虚拟键盘。
从这里开始
var hideKeyboard = function() {
document.activeElement.blur();
$("input").blur();
};
编辑:另一种选择
$('.clr').after('
//<input tyep="checkbox"
<input type="checkbox"
id="focusable"
style="height:0;
margin- left:-200px;
clear:both;" />');
$('#focusable').focus(); `