使用正则表达式加上字符串对象的replace函数来实现trim功能。 $("#streamid").val().replace(/(^[\\s]*)|([\\s]*$)/g, "") 相关文章: 2021-07-03 2021-12-01 2022-12-23 2021-07-31 2021-11-28 2022-12-23 2022-12-23 2022-12-23