remove from TinyMCE editor content value

I have described at my another post how to set up TinyMCE editor to any application. To get/set the content of editor use this function

V3 or later :

text = tinyMCE.activeEditor.getContent() // for get

tinyMCE.activeEditor.setContent(text) // for set

older version:

text = tinyMCE.getInstanceById(’txtNote’).getBody().innerHTML // get

tinyMCE.getInstanceById(’txtNote’).getBody().innerHTML = text //set

but current version has one problem that is every time it add <p> at beginning and </p> at ending. thats why i have created one method that return the exact content.

function tinyMCE_getContent(txtAreaId) { //strips html tags leaving plain text
var content = tinyMCE.get(txtAreaId).getContent();
var re = /(<([^>]+)>)/ig ; //strip all tags
plaintext = content.replace(re, “”);
return plaintext;

One thought on “remove from TinyMCE editor content value

Leave a Reply

Your email address will not be published. Required fields are marked *