2012-09-12 33 views
0

可能重复:
.trim() in JavaScript not working in IE为什么我得到的错误IE修剪方法不支持?

我有下面的代码,但在IE它说,修剪方法不被支持。

for (var i = 0; i < here.length; i++) { 

     if ($(here[i]).html().trim() == "") 
      $(here[i]).parent().find('#content').css('width', '656px'), 
      $(here[i]).parent().find('#content p').css('width', '430px'); 

     if ($(another[i]).html() != null) { 
      if ($(another[i]).html().trim() == "") 
       $(another[i]).parent().parent().css('display', 'none'), 
       $('#sidemenu .heading').css('background', 'none'); 
     } 
    } 

我该如何解决?

回答

1

较旧版本的浏览器(例如版本9之前的IE)对于在其Javascript中实现的字符串没有trim方法。您有以下选择:

相关问题