自定義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

相關文章
相關標籤/搜索