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()
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With