简体   繁体   English

jQuery选择器在IE中不起作用

[英]jquery selector not working in IE

these two selectors is not working in Internet Explorer 8 (they work okay in Firefox, Safari and Chrome). 这两个选择器在Internet Explorer 8中不起作用(在Firefox,Safari和Chrome中它们可以正常工作)。

$(this.children).stop().animate({ color: "#4B2B26" }, 300);
$(this).find('a').stop().animate({ color: "#4B2B26" }, 300);

Help is appreciated, thanks! 感谢帮助,谢谢!

edit; 编辑; I think it's a problem with jquery.js.. Each time i hover a object the debugger trows out; 我认为这是jquery.js的问题。每次我将鼠标悬停在某个对象上时,调试器就会抛出该异常; "Invalid Argument, Jquery.js line 137 Code 0". “无效的参数,Jquery.js第137行代码0”。

now i have; 我现在有;

$("a", this).stop().animate({ 'color': '#CEEAE6' }, 300); 

also NOT working in IE. 也不能在IE浏览器。

BUT this one is working fine in IE; 但是这个在IE中工作正常;

$("h3", this).stop().animate({ 'border-bottom': '5px solid #CEEAE6' }, 0);

No idea about the second rule, but for the first rule can you try this: 不知道第二条规则,但是对于第一条规则,您可以尝试以下操作:

$(this).children().stop().animate({ color: "#4B2B26" }, 300);

.children() is a jQuery method, thus browser independent. .children()是jQuery方法,因此与浏览器无关。 "this.children" returns the children property of whatever "this" is at that moment. “ this.children”返回当时“ this”是什么的childrens属性。 Don't know if that is even a supported property for a DOM element in IE. 不知道IE中DOM元素是否甚至还支持该属性。 Using "this.childNodes" might also do the trick here but probably also not browser independent... 使用“ this.childNodes”在这里也可以解决问题,但可能与浏览器无关...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM