Avatar of Ast35
 asked on

<a> tag onclick event not firing reliably when tapped on iPod Touch Safari

We are building a mobile website using JQTouch, and we need to trigger a Javascript function when a link is tapped, but the onclick event seems to be firing only some of the time. I think it has to do with the amount of pressure used for the tap. The link itself is being followed all the time, but the function only executes some of the time. Which isn't much good as the div the link goes to is supposed to display information output by the function.

Any ideas?

JavaScriptWeb DevelopmentiPhone

Avatar of undefined
Last Comment

8/22/2022 - Mon

Can I see how you have your link set up?

<a id="getresultsbutton" class="flipleft getresults" href="#results"  onclick="getInitialresults(); " >Get results</a>

It works as expected when I click it in Firefox.

You might want to consider disabling the href with something like "javascript:void(0);" and placing a window.location = "http://yoursite.com/"; in your getInitialresults() function.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

Try to use a DIV instead a link

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Accepting my own post as the solution so that I can close the question.