Jquery/Javascript和Css条件不匹配';不能在firefox和IE上工作。它可以在Chrome上工作

Jquery/Javascript和Css条件不匹配';不能在firefox和IE上工作。它可以在Chrome上工作,javascript,jquery,css,firefox,if-statement,Javascript,Jquery,Css,Firefox,If Statement,为什么“做点什么”可以在Chrome上运行,而不能在Firefox 16和Internet Explorer 9上运行? 如果我删除If条件,它会工作,但我需要它,因此无法删除。 这是css $('.myclassname').mouseover(function(){ if($(this).children('span').css('font-weight')=='normal') {..do something... } } 试试这个: div.myclassname spa

为什么“做点什么”可以在Chrome上运行,而不能在Firefox 16和Internet Explorer 9上运行? 如果我删除If条件,它会工作,但我需要它,因此无法删除。 这是css

$('.myclassname').mouseover(function(){

  if($(this).children('span').css('font-weight')=='normal')

  {..do something... }

}
试试这个:

div.myclassname span {...; font-weight:normal ; ...}

你能在JSFIDLE中设置它吗?是否:

if($(this).children('span').eq(0).css('font-weight')=='normal')
工作?

试试看

$('.myclassname').mouseover(function(){
    $('span',$(this)).each(function(){
      if($(this).css('font-weight')=='normal'){
       //do something
      }
    });
});


检查这里
font-weight
return 400 in JS.

你能发布一个你正在使用的HTML标记的例子吗?你真的在
{}
前有一个空行吗?它可以工作!在Firefox和IE上测试。对不起。我必须更精确一些。400仅适用于IE和FF。在Chrome上不起作用。为了使它工作,我添加了一个OR和我的原始状态“正常”。如果您有其他解决方案,请随意编写。Thanks@CalCon我会通过添加
条件来做同样的事情。
if($(this).children('span').css('font-weight')=='400')
if($(this).children('span').css('font-weight')==400)