document.getElementById("id").value.replace(/(^\s*)|(\s*$)/g,""); 去除左右空白
${test?trim}
本文介绍了一种使用JavaScript去除字符串两端空白的方法。通过document.getElementById('id').value.replace(/(^s*)|(s*$)/g,'')实现字符串的前后空白字符移除。
document.getElementById("id").value.replace(/(^\s*)|(\s*$)/g,""); 去除左右空白
${test?trim}
3万+

被折叠的 条评论
为什么被折叠?