It works in jQuery 1.6.3 but not jQuery 1.6.4
http://jsfiddle.net/xxwr4/
$("#a").click(function(){
alert("click");
});
<a id='a' href="#">test</a>
This is jsFiddle's bad I believe, not jQuery.
I get an error when trying to attach to the window
's load event. Something tells me they've pushed an un-tested update.
[11:01:16.970] window.addEvent is not a function @ http://fiddle.jshell.net/_display/:18
So, what's basically happening is your event isn't being attached because when it tries to bind your javascript code to execute after the DOM is ready it bombs. Switching to no wrap (body) in the fiddle allows it to work.
No, I think it's jsFiddle that's broken. If you switch it to "onDomReady" it works.
The issue is on jsfiddle's side. If you change it from onLoad to onDomReady it'll correct the problem.
精彩评论