自定义js去除字符串空格

String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.RTrim = function()
{
return this.replace(/(\s*$)/g, "");
} this

使用方法以下:prototype

var a=$('#a').val().Trim()io

相关文章
相关标签/搜索