jquery: a safari bug?

2019-09-03 19:19发布

问题:

Can anyone tell me why this page causes a strange problem on Safari? If you click on any of the boxs on Safari, you will get a multiple alerts or countless alerts.

This is only a simple jquery code,

$(document).ready(function(){

    $('.tile-item').click(function(){
        alert('0');
    });

});

It should just alert one alert box on each click like other browsers (even IE works ok too!)

How can I fix this?

Thanks.

EDIT:

I tested it on Windows 7 Safari 5.0.5 (7533.21.1)

Any has checked it on their Windows?

Thanks.

回答1:

Clicking on the alert box will click through it and click the box in the background. You can test this by placing the alert box away from your boxes.

The trick is not to use alert for testing your code works.

if you need to display data try the jQuery dialog from jQuery UI.