[英]hide keyboard on ios device when focus in input
當一些插件(或其他代碼)使用純javascript(或jquery庫)設置焦點到html頁面上的輸入元素時,我想在ipad設備上隱藏虛擬鍵盤
您將不得不再次模糊它,但鍵盤可能會閃爍。
$('input').on('focus', function() { $(this).blur(); });
或者,取決於您是否已動態創建input
元素。
$('#wrapper').on('focus', 'input', function() { $(this).blur(); });
Typescript版本需要在HTMLElement
上觸發blur()
。 像這樣:
let myElement: HTMLElement;
myElement = <HTMLElement>document.activeElement;
myElement.blur()
有時,它需要等待一段時間。
setTimeout(function() { document.activeElement.blur(); }, 100);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.