/**
* 删除左右两端的空格
*/
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g, '');
}
调用方式:
var searchValue=$("#searchValue").val();
if(null != searchValue && '' != searchValue){
searchValue = searchValue.trim();
}
/**
* 删除左右两端的空格
*/
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g, '');
}
调用方式:
var searchValue=$("#searchValue").val();
if(null != searchValue && '' != searchValue){
searchValue = searchValue.trim();
}
转载于:https://www.cnblogs.com/juanzila/p/8567889.html