i have the following contents inside textarea/tinyMCE editor (id of my textarea is "notice":
<div ...>
some contents here
</div>
<div id="myDiv">
Require to be updated from jQuery function
</div>
<div...> other div </div>
I am can put some contents here inside div element:(specially to the following div):
<div id="myDiv"></div>
I can put contents here, if cursor is blinking here inside "myDiv", with the following code:
tinyMCE.activeEditor.execCommand('mceInsertContent', false, parties);
using the above in the following javascript function with button onclick event:
function insert_contents(someContents){
try {
tinyMCE.activeEditor.execCommand('mceInsertContent', false, someContents);
} catch (e) {
alert(e.message);
}//catch
}//end function
My question: Is there anyway that i may put some contents inside "myDiv" div element and when if need it to remove may also remove the same contents from "myDiv" div without clicking the mouse there inside "myDiv"? Regards
You can use
getContent()to extract the entire contents of the editor and then modify it as you need. You then would usesetContent()to put the updated data back into the editor.https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#getcontent https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#setcontent