开发者

jQuery click event not working IE7 and IE8

开发者 https://www.devze.com 2023-03-01 03:43 出处:网络
The following code in IE7 or IE8 doesn\'t work. Is this开发者_如何转开发 a bug? It works fine in IE6 (Incredible!)

The following code in IE7 or IE8 doesn't work. Is this开发者_如何转开发 a bug? It works fine in IE6 (Incredible!)

http://jsfiddle.net/zgSmT/


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.


You might try

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

To ensure everything is loaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消