I use plugin CKEDITOR for word editor in my web. Inside the editor I have a table which have two columns . I want to achieve that in the first column if the user input number it will add to (50) and the result automatically appear in the second column. That is very easy using Jquery but it does not work. Tried codes:
function insertIntoCkeditor(str){
CKEDITOR.instances['editor1'].insertText(str);
}
but this code insert automatically above the text area of the editor.
Use
setData()
It will remove the existing data in the ckeditor and and it will replace it with 'str' variable content.
function insertIntoCkeditor(str){
CKEDITOR.instances['editor1'].setData(str);
}
I am using insertHtml : It will put the text at cursor position and no removal of existing text. Its like updating the content of ckeditor. this separates it from setdata()
function InsertHTML(HTML)
{
CKEDITOR.instances['editor1'].insertHtml(HTML);
}
and it works fine. ;)
CKEDITOR.instance['editor1'].insertElement(str);
It will be insert text in cursor position
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With