怎麼了jQuery修剪方法?jQuery對象不支持屬性或方法修剪()在IE瀏覽器
jQuery('#Reminders').attr('value').trim()
對象不支持屬性或方法 '修剪'
jQuery('#Reminders').attr('value')
「5,1,1」
$('#Reminders').attr('value').split(',')
[5,1,1]
[0]: "5"
[1]: "1"
[2]: "1"
我沒有在Firefox或Chrome,這些不幸...只有IE 9.0。 trim()有什麼特別的...我沒有得到備忘錄。
所以你不要覆蓋'trim'方法,如果它已經存在,你可以這樣做:'String.prototype.trim = String.prototype.trim || function(){ return this.replace(/^\ s + | \ s + $/g,''); }' –