开发者

How do i trim in javascript or jQuery?

开发者 https://www.devze.com 2023-01-21 12:11 出处:网络
how do i trim using this $(\'#type_of_station\').text() 开发者_如何转开发 the result is >>> $(\'#type_of_station\').text()

how do i trim using this

 $('#type_of_station').text()
开发者_如何转开发

the result is

>>> $('#type_of_station').text()
"pizza delivery system "

As you can see there is a space after the last word


jQuery: str = jQuery.trim(str);

JavaScript: str = str.replace(/^\s*/, "").replace(/\s*$/, "");


Use the JQuery.trim() function.

0

精彩评论

暂无评论...
验证码 换一张
取 消