为什么这不能在iPad上运行?

Why doesn't this work on iPad?

本文关键字:运行 iPad 不能 为什么      更新时间:2023-09-26

它可以在所有浏览器上正常工作,只是在iPad safari上。如果我在浏览器上模拟为iPad用户代理,它就可以正常工作。

http://jsfiddle.net/NMcuy/38/embedded/result/

问题是,如果我输入文本(添加文本),iPad的键盘显示,我可以按下键,但它不会显示在可拖动的div中。即使默认文本保持不变。

我不知道问题是:(

function newText()
{
var note = new Note();
note.id = ++highestId;
var text = document.createElement('textarea');
text.name = "text";
text.setAttribute("onkeyup", "textAreaAdjust(this)");
text.setAttribute("class", "text");
//text.innerHTML = initialText;
note.contentField.appendChild(text);
note.name = note.id + "_text";
note.left = Math.round(Math.random() * 400) + 'px';
note.top = Math.round(Math.random() * 500) + 'px';
note.zIndex = ++highestZ;
note.saveAsNew();
}

根据我的研究,这是iOS关于焦点(或委派焦点)事件的一个bug/(特定功能)。

Mobile Safari自动对焦文本字段