ACP
ACP

Reputation: 35264

JavaScript to find TinyMCE rich text editor value is null or not

I use the TinyMCE textarea in one of my web applications.

  1. How to check the TinyMCE textarea's value is null or not using JavaScript?

document.getElementById("myeditorid").value didn't help me.

Upvotes: 7

Views: 14531

Answers (2)

Abhishek
Abhishek

Reputation: 11

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

Upvotes: 1

Guffa
Guffa

Reputation: 700800

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();

Upvotes: 14

Related Questions