Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Object doesn't support property or method trim() in IE

What's up with the jQuery trim method??

jQuery('#Reminders').attr('value').trim() 

Object doesn't support property or method 'trim'

jQuery('#Reminders').attr('value') 

"5,1,1"

$('#Reminders').attr('value').split(',')  [5,1,1] [0]: "5" [1]: "1" [2]: "1" 

I don't have these woes in FireFox or Chrome ... only IE 9.0. Is there something special about trim() ... I didn't get the memo .

like image 642
Pablo Avatar asked Oct 10 '11 22:10

Pablo


1 Answers

IE doesn't have a string.trim() method.

Instead, you can call jQuery's $.trim(str).

like image 85
SLaks Avatar answered Sep 17 '22 18:09

SLaks