1、ie8下使用trim失效
trim可以除去字符串两侧的空白字符,但ie8并不支持
2、解决方案
String.prototype.trim = function () {
return this .replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' );
}
trim可以除去字符串两侧的空白字符,但ie8并不支持
String.prototype.trim = function () {
return this .replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' );
}
转载于:https://www.cnblogs.com/lhyhappy365/p/6137297.html