2012-09-19 73 views
4

此代码在Chrome,FF,Safari浏览器,IE9但IE8运行此属性或方法我收到此错误:对象不支持只在IE8

Message: Object doesn't support this property or method Line: 80 Char: 7 Code: 0

,这就是它的代码停在: (80线是“回归[”但开发工具调试器突出以下所有代码)

return [ 
    { 
     title:'Edit', 
     customClass:'actionEdit', 
     action:{ 
      type:'getLink', 
      url:'/admin/products/edit/'+data.id()+'' 
     } 
    }, 
    { 
     title:'Attaches', 
     customClass:'actionAttaches', 
     action:{ 
      type:'getLink', 
      url:'/admin/attaches/index/product/'+data.id()+'' 
     } 
    }, 
    { 
     title:'Delete', 
     customClass:'actionDelete', 
     action:{ 
      type:'postLink', 
      url:'/admin/products/delete/'+data.id()+'', 
      confirm:'Are you sure you want to delete %s?', 
      arg:$('#ProductAdminIndexList #'+data.id()+' .productId').text().trim() 
     } 
    } 
]; 

我发现其他类似的案件,但我不知道为什么会发生,以及如何才能解决这个问题。

+1

IE8不支持某些(非标准的,但共同的)投票的方法,如'trim'。看到这里:http://stackoverflow.com/a/2308157/1001985 – McGarnagle

回答

8

解决这个问题。

arg: $.trim($('#ProductAdminIndexList #'+data.id()+' .productId').text()) 
+1

为什么downvote?我们已经知道正在使用jQuery,那么为什么不使用它的修剪功能呢? – lbstr

相关问题