您的当前位置:首页正文

js/jq去除首尾空格

来源:要发发知识网

js

String.prototype.trim = function() {
  return  this.replace(/^\s+|\s+$/g, '');
}

jq

$.trim(str)