Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 clEditor 控件,当我在选择控件中选择一个项目时,我需要在 textarea 的光标位置添加文本。
有人可以帮助我,拜托。
谢谢!
text_to_add此代码将在光标位置从变量添加文本:
text_to_add
var text_to_add = 'Welcome to Senegal !'; var editor = $('.my_textarea').cleditor()[0]; editor.focus(); setTimeout(function() { editor.execCommand('inserthtml', text_to_add, false); }, 0);