简体   繁体   中英

javascript validation on tiny mce text editor

Hai

I want to validate (empty check) a tiny mce text editor using JavaScript. Does any one know this? I have used the normal empty check function. But it's not working. Does any one help me? also I want to know how validate empty check in FCk editor.

Try Following in your javascript

if(tinyMCE.get("chatContent_field").getContent()==''){
   alert("Please enter the text.");
   return false;
}

wheer "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM