jQuery live not working in IE8

僤鯓⒐⒋嵵緔 提交于 2019-12-24 10:14:57

问题


The following works in Firefox 3 and IE 7 but not in IE8.

Given this HTML snippet:

<li><a href="#" class="remove">remove me</a></li>

javascript:

jQuery('.remove').live('click', function(e){
            jQuery(this).parent().remove();
        });

I wish I had an error message to work with but I don't.

How can I get this to work in IE8?

I should also mention that the anchor tag is being generated by prototype version 1.6.0.

UPDATE: This is a bug in Prototype 1.6.0 and is fixed in 1.6.1 See Issue


回答1:


As I mentioned in the question, the anchor tag is being generated by Prototype 1.6.0. This has a bug that generates the class attribute as "className" instead of just "class". jQuery does not recognize the "className" attribute and therefore my code example fails. This was identified as a bug in Prototype in their issue tracking system and was fixed in 1.6.1.



来源:https://stackoverflow.com/questions/6154749/jquery-live-not-working-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!