天天看點

js代替Trim()的方法

js中木有Trim()方法,去掉空格可以

if (txtid.Trim() == "") {

換成

if (txtid.replace(/(^\s*)|(\s*$)/g,'') == "")