user962408
user962408

Reputation: 147

How to remove all html in TinyMCE Editor?

In TinyMCE Editor,when you remove "p", just like the following code.

How to remove all ???

tinyMCE.activeEditor.dom.remove(tinyMCE.activeEditor.dom.select('p'));

Upvotes: 3

Views: 4373

Answers (3)

David Dutra
David Dutra

Reputation: 401

If you have multiple instances of tinymce textareas in the same page, you might use:

tinyMCE.get('your-textarea-id').setContent('');

Upvotes: 0

Thariama
Thariama

Reputation: 50832

To be sure only paragraphs get deleted use:

$(tinymce.activeEditor.getBody()).find('p').remove();

Due to the fact that tinymce.activeEditor gets set the first time when a user clicks in it it might be a better choice to use the explicit editor instance (which is available even before a user clicks into the editor). To get it use:

tinymce.get('your_editor_id');

Upvotes: 1

Rory McCrossan
Rory McCrossan

Reputation: 337560

Try this:

tinyMCE.activeEditor.setContent('');

setContent reference

Upvotes: 5

Related Questions