Avatar of Ast35
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?

Thanks.
JavaScriptWeb DevelopmentiPhone

Avatar of undefined
Last Comment
Ast35
Avatar of OmniUnlimited
OmniUnlimited
Flag of United States of America image

Can I see how you have your link set up?
Avatar of Ast35
Ast35

ASKER

<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.
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Try to use a DIV instead a link
ASKER CERTIFIED SOLUTION
Avatar of Ast35
Ast35

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Ast35
Ast35

ASKER

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

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo