admin管理员组文章数量:1391751
Is it possible to control the display i.e.(show/hide) of keyboard in iPad Safari through code?
I have 2 form fields; 1. Text box (say Name) 2. Select list/Dropdown (Say State)
My question is when user moves focus from Name to State, the keyboard is still there..Why is it so and how can I hide the keyboard when focus moves to dropdown?
Thank you.
Is it possible to control the display i.e.(show/hide) of keyboard in iPad Safari through code?
I have 2 form fields; 1. Text box (say Name) 2. Select list/Dropdown (Say State)
My question is when user moves focus from Name to State, the keyboard is still there..Why is it so and how can I hide the keyboard when focus moves to dropdown?
Thank you.
Share Improve this question edited Jul 2, 2013 at 14:31 Paul D. Waite 99k57 gold badges203 silver badges271 bronze badges asked Apr 15, 2011 at 9:55 copenndthagencopenndthagen 50.9k105 gold badges313 silver badges491 bronze badges 1- Your question should not ask about showing the keyboard when you are only interested in hiding it. – Michael Commented Nov 29, 2013 at 23:20
2 Answers
Reset to default 2I just ran into a very similar problem, not sure if my solution will work for you.
In my case, I have a text input inside a form. On submit, I'm using e.preventDefault()
to stop the page from navigating. I believe this was also having the effect of stopping the default action of hiding the keyboard.
To solve this, I added an explicit input.blur()
when the form is submitted. This seemed to be enough for safari to remove the keyboard.
Hope this helps!
I had the same issue. I had a form were keyboard should be collapsed when type out of the field (not native behavior on ipad) and when focus select field. The only solution for me was creation of hidden input
<input type="hidden" id="blurInput" />
and javascript code handler for focus event:
$element = $(event.target);
if($element.is('select')) {
$('#blurInput').blur();
$element.focus();
}
In case you want just to blur input field another solution works perfect, but between input and select it fails
document.activeElement.blur();
$('input').blur();
本文标签: iphoneCan you showhide the iPad Safari keyboard using JavaScriptStack Overflow
版权声明:本文标题:iphone - Can you showhide the iPad Safari keyboard using JavaScript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744762799a2623851.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论