的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