The problem arises:
In the use of the process, using the traditional JS method to judge TinyMCE selected textarea (hereinafter referred to as TEXTAREA) the value of this problem will occur:
In the existing input, the first time the submission, will still pop up the JS write warning prompt, and then submit to be successful.
When I learned that JS could not get textarea value directly, we looked around for solutions.
With the help of Bo friend Nkxyf, this problem has been solved.
Looking at the official documents for a long while, because English is not good, and is affected by other HTML text editor, I thought TinyMCE's documents will be in installation this piece will give the method of getting HTML content, but unfortunately I found a day. I can't find them either.
Fortunately, Baidu found Nkxyf bo Friends of a blog post: http://www.cnblogs.com/nkxyf/p/3883586.html
Ask him to fix the problem! Because the blog post is issued in July, I thought my message will be a long time to have a reply, but soon, the mailbox reminds me that Nkxyf quickly replied to my question. It was a surprise! At the same time also feel the blog Park mailbox alert function is really convenient!
All right, no more talking nonsense. Go to the Chase
tinymce4.x version js the correct way to get the value of textarea: var content = tinymce.get (' elm1 '). GetContent (); Note: ELM1 is the ID value of textarea, do not add #. TINYMCE can be used, or can be used TINYMCE
method on the official website of this document: Http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.getContent
// get the HTML contents of the currently active editor (gets the HTML content of the currently active editor) Console.debug (TinyMCE.activeEditor.getContent ()); // get the raw contents of the currently active editor (gets the native content of the currently active editors)TinyMCE.activeEditor.getContent ({ Format: ' Raw '}); // get content of a specific editor: (Get the contents of the specified editor, the above example is in this way) Tinymce.get (' Content ID '). getcontent ()
Something to think about the official documents first, but Baidu should first look at the document.
Get the value of tinymce4.x by JS