jQuery Object doesn't support property or method trim() in IE
Solution 1:
IE doesn't have a string.trim()
method.
Instead, you can call jQuery's $.trim(str)
.
Solution 2:
You can add trim() method on String object, for browsers without support for this method (IE alike).
Simply add these lines before you call trim() method:
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
Solution 3:
trim()
is not invoked like that in a jQuery context.
Once you call attr()
, that's the end of jQuery chaining. See http://api.jquery.com/attr/
To do this, do:
jQuery.trim(jQuery('#Reminders').attr('value'));
See: http://api.jquery.com/jQuery.trim/
Solution 4:
Same problem here with IE not having the trim()
method. I solved by adding the trim()
if it doesn't exist.
(function(str) {
if (typeof(str.prototype.trim) === 'undefined') {
str.prototype.trim = function() {
return $.trim(this);
};
}
})(String);
Works great.