Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6780279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:29:15+00:00 2026-05-26T16:29:15+00:00

I have a project using jQuery and a lot of dynamically-generated content. There is

  • 0

I have a project using jQuery and a lot of dynamically-generated content. There is a click handler on the upper-left-most element– the “initiative” score– and it works fine on desktop Safari but isn’t called at all on Mobile Safari; the gray overlay never appears and no action is taken. It’s the same story with the click handler on the Hit Points area (the 172 at right) and the status (“Add Status Effect” at bottom; confirm; it appears over the portrait): all work on desktop but not mobile Safari.

I’ve reduced the code to the following:

<html>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    <script>
      $(function() {
        $('#dynamic').click(function() {alert("works")});
        $('#dynamic-with-onclick').click(function() {alert("works")});
        $('#dynamic-with-dynamic-onclick').click(function() {alert("works")}).attr('onclick', '');
      })
    </script>
  </head>
  <body>
    <ul>
      <li id='static' onclick='alert("works")'>If there's an onclick it's called</li>
      <li id='dynamic'>And if there's no onclick the iPad won't see other click events</li>
      <li id='dynamic-with-onclick' onclick=''>But if there is one all events are called</li>
      <li id='dynamic-with-dynamic-onclick'>And if we add one everything works</li>
    </ul>
  </body>
</html>

Update

This appears to be much simpler now than when I originally asked this question 10 months ago; using modern Mobile Safari all click handlers will register as normal. So go forth and just use $(...).click(function() {})!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:29:15+00:00Added an answer on May 26, 2026 at 4:29 pm

    We could do the hackish thing and just add onclick to anything we want clickable. But the “right” way to do this seems to be using an iPad-appropriate event:

    var hitEvent = 'ontouchstart' in document.documentElement
      ? 'touchstart'
      : 'click';
    $('#dynamic').bind(hitEvent, function() {alert("works")});
    $('#dynamic-with-onclick').bind(hitEvent, function() {alert("works")});
    $('#dynamic-with-dynamic-onclick').bind(hitEvent, function() {alert("works")}).attr('onclick', '');
    

    Another way to do it is to bind to multiple events and be happy with whichever one gets called.

    I’m currently using the first solution; I might try the other one, as I think it’s cleaner.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using jQuery in our project. We have numerous custom javascript files in
I have a test project using MbUnit and TestDriven.Net. If I right-click on an
I have generated a C# SharePoint Sequential Workflow project using the very handy STSDEV
This is a Rails 3 project using jQuery 1.4.4. I have an index action
I'm using jQuery for a project and have probably a dozen or so additional
I am currently using jQuery Mobile on a project and have run into a
I have a little project I am working on and I am using jQuery.
We're using jQuery on a less UI-intensive project whereas we have been using ExtJS
I am currently working on a project using jQuery and JavaScript. There will be
in this project im using jquery and phonegap i have a link that if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.