简体   繁体   中英

Trim is not working in IE7

trim() javascript function not working in IE7 however it' working fine in all other version and all browser. what should be issue with IE7 or how i can resolve this?

$("#Email").val().trim()

IE7给出了错误

Thanks in advance.

IE doesn't support String.prototype.trim() until IE9.

It looks like you're using jQuery, so you can use $.trim() instead.

$.trim($("#Email").val())

The val() method doesn't always return a string . If the selected item is an option it can return an array which doesn't support trim . Have you checked the type of val() to see if it's actually a string ?

Note: As others have pointed out trim isn't supported on IE7 even if this is a string . Need at least IE9.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM