Skip to content Skip to sidebar Skip to footer

Onclick() Not Working In Safari

The below code works fine on IE7 but not in Safari(5.0.5). If possible, I want to avoid using jQuery. The goal is for this functionality to work on iPad but right now testing with

Solution 1:

In Safari, the click() method (which simulates a mouse click) cannot be applied to an <img>. But, it can be applied to an <input type="image">. Are you able to use that?

Solution 2:

As gilly3 noted, the issue you're having is that you cannot call click() on an <img>. This does not mean that the onclick handler does not work. If you take your mouse and click on the image, the handler will still fire.

Now, if you want to simulate the click, this answer will give you everything you need to do that.

Post a Comment for "Onclick() Not Working In Safari"