1、用jquery的trim()方法,$.trim(str)就可以了。
2、String扩展:
第一种 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, ""); }
解决Html IE8 readonly的 textbox 中还有 光标
第一种方法:<inputtype="text" readonly="readonly" unselectable='on'/>
第二种方法:<inputtype="text" readonly="readonly" onfocus="this.blur()"/>
解决乱码现象encodeURI()