my code <html> </head> <script language="javascript" type="text/javascript" src="../AT_STD_WYS_v1.5/wysiwyg.js"> function chkvaild() { var d=document.formname; if(d.content.value=="") { alert('Enter the Text!'); d.content.focus(); return false; } return true; } </script> </head> <body> <form method="post" action="sending_sms.php" name="formname" onSubmit="return chkvaild()" style="padding-top:5px;" enctype="multipart/form-data"> <textarea name="content" id="content" style="width:250px; height:90px;"></textarea> <script language="javascript1.2"> generate_wysiwyg('content', '500', '200'); </script> </body> </html> this is my code validation not working if i remove text editor its working can anyone tell me how to slove this prblm
The text editor must be adding some content (like some blank spaces). Try throwing an alert box with the content. Trim the blank spaces before validation. Here is some code for trimming the blank space: function str_trim(strIn) { return strIn.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } Code (markup):