js如何判断textarea输入的内容不能为空


String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
}
function saveThis(){
var subject = document.getElementById("subject").value;
var fatieContent = document.getElementById("fatieContent").value; alert("fatieContent:"+fatieContent.trim());
        if(subject.trim() ==''){
     alert("日志标题不能为空!");
     return false;
  }else if(fatieContent==''){
  alert("内容不能为空!");
  return false;
 }

<textarea name="fatieContent" id="fatieContent"  >
<s:property value="fatieContent" escape="false"/>
</textarea>

求指教关键是空格的处理 
   我输入了一排空格然后回车再空格 a 作为测试 其结果是

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM