<分区>
Possible Duplicate:
How to insert text at the current caret position in a textarea
我想在插入符号位置使用 javascript 在文本区域中插入文本,我已经有了找到该位置的代码,将文本放在该特定位置的代码是什么?
谢谢,
jack
标签 javascript jquery
<分区>
Possible Duplicate:
How to insert text at the current caret position in a textarea
我想在插入符号位置使用 javascript 在文本区域中插入文本,我已经有了找到该位置的代码,将文本放在该特定位置的代码是什么?
谢谢,
jack
最佳答案
var myTextarea = ... // select the text area
$(myTextarea).html('The text I want to insert'); // this will replace the existing contents
要将文本附加到文本区域,请使用:
$(myTextarea).html($(myTextarea.html() + 'The text I want to insert');
关于javascript - 在插入符号位置的文本区域中插入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7612375/
相关文章:
javascript - 在 Kendo UI 中将网格 pageSize 设置为变量
javascript - 如何仅使用 javascript 和 html 在 <div> 标记中加载嵌套网页?
javascript - Angular JS 不会在 IE 8 中渲染 View
javascript - HTML - 为 <div> 中的 <div> 复制和应用唯一 ID
javascript - 从 javascript 调用 ItemEditForm 上的保存操作
javascript - 在 Spotfire 中实现 Javascript