2014年1月27日 星期一

[Javascript] trim() is not working in IE8

Error Message

Object doesn’t support this property or method


Solution

1. replace

str.replace(/^\s+|\s+$/g,"")


2. jQuery:

$.trim("str");



* Reference
. trim()

沒有留言:

張貼留言