使用window.location时,jQuery .css函数无法正常工作

时间:2013-08-26 11:21:24

标签: javascript jquery window.location

我有一个JavaScript函数:

($('.expand').parent().next().children('li')).click(function() {
    $(this).css('background','#aaaaaa');
    window.location=($(this).children('a')).attr('href');    
  });

我在ios设备中获得背景颜色但在samsung android原生浏览器中没有工作。

有没有人遇到过这个问题。请指教。

被修改

如果我使用

($('.expand').parent().next().children('li')).click(function() {
    $(this).css('background','#aaaaaa');
});

没有window.location我得到了背景颜色,但我想要bgcolor和重定向

1 个答案:

答案 0 :(得分:0)

使用背景色而不是背景色:

$(this).css({backgroundColor: '#aaaaaa'});

$(this).css('background-color', '#aaaaaa');