I use the TinyMCE textarea in one of my web applications.
document.getElementById("myeditorid").value
didn't help me.
The TinyMCE getContent and setContent methods You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.
Rich Text is a field type that enables authors to create rich text content, similar to traditional "What you see is what you get" (wysiwyg) editors. The key difference here is that the Contentful Rich Text Field (RTF) response is returned as pure JSON rather than HTML.
TinyMCE is an online rich-text editor released as open-source software under the MIT License. It has the ability to convert HTML text area fields or other HTML elements to editor instances. TinyMCE is designed to easily integrate with JavaScript libraries such as React, Vue.
It's not a textarea any more, so the value property won't work.
This is how you get a reference to the editor, and the text from it:
var text = tinyMCE.get('myeditorid').getContent();
var text = tinyMCE.get('createSurvey:thankyouMsg_ifr').getContent();
here the predefined id was "thankyouMsg"..After the tinyMCe,its id changed to this.I try to get the value in this way but it is not working saying tinyMCE.get('createSurvey:thankyouMsg_ifr')
is undefined
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With