的HTML代碼看起來像這樣如何在特定位置添加/插入/更新contenteditable div中的文本?
<div id="txtarea" contenteditable="true">Some text</div>
我在上面的DIV的特定位置插入基於某些事件的一些新的文本。 事件調用函數say updateDiv(txt,positon)。比如它說
updateDiv("more ",5);
所以DIV應該成爲是
<div id="txtarea" contenteditable="true">Some more text</div>
我嘗試了大量的JavaScript和jQuery但沒有什麼似乎工作。
http://stackoverflow.com/questions/1882890/jquery-insert-text-to- textarea – 2012-04-25 12:28:18
@ RokoC.Buljan:不,這個問題涉及到textareas,而不是'contenteditable'。 – 2012-04-25 12:38:41
**在另一個字符串的位置x插入字符串**:http://stackoverflow.com/questions/4364881/inserting-string-at-position-x-of-another-string – RASG 2012-04-25 13:20:56