Monday, June 1, 2009

[jQuery] Weird Problem with Default Web Page in Some Browsers

Hi all,

I've got a frustrating problem I can't figure out, and thought someone
here might be able to help. Seems so simple that I must be doing
something wrong, but not sure what to do about it...

When I load my site with just the URL and depend on the default page
getting loaded (i.e. www.mysite.com), the page shows fine but my
events don't seem to get registered. When I specify the default page
explicitly (i.e. www.mysite.com/index.html), all is good. Here's how
I'm registering the events:


$(document).ready( function() {

$('body').click( function(event) {
if ( $(event.target).is('#myevent') )
{
setEvent();
}
});

});


But it only happens in FireFox and IE pre-IE8. In Chrome, Opera,
Safari, and IE8 it just works.

Any ideas how to fix it?

No comments: