jQuery click event not working IE7 and IE8

2019-04-13 18:51发布

The following code in IE7 or IE8 doesn't work. Is this a bug? It works fine in IE6 (Incredible!)

http://jsfiddle.net/zgSmT/

2条回答
别忘想泡老子
2楼-- · 2019-04-13 19:22

You might try

$().ready(function ()
{
    $('#clickme').live('click', function(){
        alert('hey');
    });
}

To ensure everything is loaded.

查看更多
祖国的老花朵
3楼-- · 2019-04-13 19:31

Try using the live event, or binding the event after document load:

$('#clickme').live('click', function(){
    alert('hey');
});

Also, you're still loading scripts.js, which doesn't exist, in your fiddle example - that might also cause a problem.

查看更多
登录 后发表回答