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

posted @ 2013-06-14 18:50  月夜风2012  阅读(5234)  评论(0编辑  收藏  举报
合肥办公家具 数控模具