admin管理员组文章数量:1302278
I am developing an application where I am using CKEditor. I have provided a button called clear. Whenever user selects some part of text and clicks on clear button only the selected text should get deleted.
I used the below code in my application but whenever user clicks on clear button not only selected text but whole content gets deleted.
function clear_onclick() {
CKEDITOR.instances.message.setData('');
}
How can I clear the selected text from CKEditor on click of clear button in ASP.Net MVC2?
I am developing an application where I am using CKEditor. I have provided a button called clear. Whenever user selects some part of text and clicks on clear button only the selected text should get deleted.
I used the below code in my application but whenever user clicks on clear button not only selected text but whole content gets deleted.
function clear_onclick() {
CKEDITOR.instances.message.setData('');
}
How can I clear the selected text from CKEditor on click of clear button in ASP.Net MVC2?
Share edited Mar 25, 2013 at 9:15 rouen 5,1342 gold badges26 silver badges51 bronze badges asked Mar 25, 2013 at 6:49 user2031327user20313272 Answers
Reset to default 11This will do the job:
var range = CKEDITOR.instances.editor1.getSelection().getRanges()[ 0 ];
range.deleteContents();
range.select(); // Select emptied range to place the caret in its place.
Try this:
CKEDITOR.instances["textAreaId"].getSelection().getSelectedText().setData('');
本文标签: javascriptHow to delete the selected text from CKEditorStack Overflow
版权声明:本文标题:javascript - How to delete the selected text from CKEditor? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741700516a2393258.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论