I am making use of trim() like so:
if($('#group_field').val().trim()!=''){
Where group_field
is an input element of type text. This works in Firefox but when I try it on IE8 it gives me this error:
Message: Object doesn't support this property or method
When I remove the trim(), it works fine on IE8. I thought the way I am using trim() is correct?
Thanks all for any help
trim() function removes all newlines, spaces (including non-breaking spaces), and tabs from the beginning and end of the supplied string. If these whitespace characters occur in the middle of the string, they are preserved.
trim() is deprecated.
The trim() method removes whitespace from both sides of a string. The trim() method does not change the original string.
Try this instead:
if($.trim($('#group_field').val()) != ''){
More Info:
You should use $.trim
, like this:
if($.trim($('#group_field').val()) !='') { // ... }
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