-1

In TinyMCE 3.x, I would use this code:

//TinyMCE 3.x
tinyMCE.get( "textAreaId" ).getContent();

But this is throwing an error in 4.x. How do I do this in 4.x?

Don Rhummy
  • 24,730
  • 42
  • 175
  • 330

1 Answers1

0

If given methods fail, you can always search for its value in the HTML document.

$('#textAreaId').siblings('.mce-tinymce.mce-container').find('.mce-container-body').find('.mce-edit-area').find('iframe').contents().find('#tinymce').find('p').html();

or

$('#textAreaId').siblings('.mce-tinymce.mce-container').find('.mce-container-body .mce-edit-area iframe').contents().find('#tinymce p').html();

a little more short

You can remove the final .find('p') if you want the content explicit with the tags.

The best one I think is:

window.parent.tinymce.get('textAreaId').getContent();

Pay attention, here is without the #

Carlos Calla
  • 6,556
  • 2
  • 16
  • 23