Posted By

cerxx on 08/01/19


Tagged

jquery iOS-hacks


Versions (?)

Click on iOs and Android


 / Published in: JavaScript
 

URL: https://stackoverflow.com/questions/10577906/how-to-make-my-click-function-work-with-ios#answer-41984774

Here is a code that force to fire a click on iOS devices, where there is first a touchstart event

  1. var UA = navigator.userAgent,
  2. iOS = !!(UA.match(/iPad|iPhone|Android/i));
  3. $(this).on("click", function(){
  4. // do somthing
  5. });
  6. if (iOS) {
  7. $(document).on('touchstart', function (e) {
  8. e.target.click();
  9. });
  10. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: maryrosie111 on August 2, 2019

very useful info, thank you for sharing with us! wuxiaworld

Posted By: NilsTimonen on August 2, 2019

Thanks for the info!

Posted By: minion89 on October 23, 2019

This article is very detailed and meticulous, I have read many articles on this topic, but for this article, you leave me a deep impression and practical application in my life. Thank you for sharing. [url=https://mapquestdirections.co]mapquest directions[/url]

You need to login to post a comment.