如何让 IE8 尊重 .removeClass()?
让我头疼的代码是这样的:
$('#timeline .selected').removeClass('selected');
它在 IE8 中无法正常运行。这些类确实被正确删除,但不知何故该元素仍然具有相同的样式,就像“选定”类的样式一样。
PS 这两个也不起作用:
$('#timeline .selected').removeAttr('class');
$('#timeline .selected').removeAttribute('class');
请帮忙!
The code that's giving me headaches is this:
$('#timeline .selected').removeClass('selected');
It just won't behave properly in IE8. The classes DO get removed properly, but somehow the element still has the same styling, just as the style with the class 'selected'.
P.S. Those two won't work either:
$('#timeline .selected').removeAttr('class');
$('#timeline .selected').removeAttribute('class');
Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新: http://jsfiddle.net/jWvdr/2/
似乎工作正常:
http://jsfiddle.net/jWvdr/
哪些 css 属性给您带来了问题?
Updated: http://jsfiddle.net/jWvdr/2/
Seems to work fine:
http://jsfiddle.net/jWvdr/
What css attributes are giving you problems?