js中判断 .html() 是否为空

String.prototype.isEmpty = function () {
  var s1 = this.replace(/[\r\n]/g, '').replace(/[ ]/g, ''),
      s2 = (s1 == '') ? true : false;
  return s2;
};
$(this).html().isEmpty();

 

posted @ 2017-12-22 17:11  不一样的开始  阅读(1195)  评论(0编辑  收藏  举报