Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tinymce get content

I try to get the content of tinymce, like this:

 var hallo = tinyMCE.activeEditor.getContent();
            alert(hallo);

but every time I get this message:

Uncaught TypeError: Cannot read property 'getContent' of null

I am using tinymce 4.

Thank you

like image 203
InfinityGoesAround Avatar asked Jul 31 '26 00:07

InfinityGoesAround


1 Answers

You can get tinyMCE content by calling the the method triggerSave in the following way

tinyMCE.triggerSave();

after declaring this method you can get the contents by selector for example:-

var contents = $("#myTextArea").val();

or

var contents = tinyMCE.get('myTextArea').getContent();
like image 53
Shahbaz Avatar answered Aug 01 '26 19:08

Shahbaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!