JavaScript validation on Tiny MCE text editor
I want to validate (empty check) a Tiny MCE text editor using JavaScript. I have used the normal empty check function, but it's not working. Also I wan开发者_如何学编程t to know how validate empty check in FCk editor.
Try the following in your JavaScript:
if(tinyMCE.get("chatContent_field").getContent()==''){
alert("Please enter the text.");
return false;
}
where "chatContent_field" is id of your text area.
The editor should put its content in the textarea it's installed upon, but it might do it after You check. Try using firebug to see what Your editor does to the textarea it covers.
If You want to check directly You have to find the iframe within the editor and access its content.
精彩评论