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 7987271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:05:56+00:00 2026-06-04T12:05:56+00:00

I am building an app for iPhone and iPad using PhoneGap and jQM <div

  • 0

I am building an app for iPhone and iPad using PhoneGap and jQM

<div class="ui-block-a">
   <a id="btnLink" href="#pageID" data-role="button"></a>
</div>

and it functions fine, but when I run it on the device (didn’t try the simulator) and press a long press, I get the default iPhone menu for a link in a normal browser to open or copy the link.

how can I disable this default feature in my app?

I tried these with no success:

$("a").click(function(event) {
  event.preventDefault(); // long press menu still apear
});


$("a").bind('click',function(event) {
console.log(['preventingclick',event.type]);
event.preventDefault(); // long press menu still apear
});

if I bind on ‘taphold’ I still see the menu on a long press, but after I click cancel I see the console log: [“preventing long press”,”taphold”]

$("a").bind('taphold', function(event) {
console.log(['preventing long press',event.type]);
event.preventDefault(); // long press menu still apear
});

if I use delegate on ‘taphold’ event like this:

$("a").delegate('taphold', function(event) {
console.log(['preventing long press',event.type]);
event.preventDefault();
});

will fix the problem, but I can’t attach any events anymore, so non of my buttons will work after that.

$('#btnLink').bind("click", function() {
$.mobile.changePage('mypage', 'slide'); // won't fire any more because of the delegate before
});

I know that delegate will apply on all elements now and in the future, but I think I am getting close to the answer, but not yet.

Thanks in advance

Anchor long press menu on iPhone

  • 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-06-04T12:05:57+00:00Added an answer on June 4, 2026 at 12:05 pm

    ok got it to work,

    I had to combine both code fixes, CSS and JavaScript

    so in my CSS I did this:

    body { -webkit-touch-callout: none !important; }
    a { -webkit-user-select: none !important; }
    

    in my JavaScript did this:

    function onBodyLoad() {
      $("a").bind('taphold', function(event) {
      event.preventDefault();
     });
    }
    

    and now all the links are disabled, but if I attach an event to any of them it will work with no problem

    THanks all

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

Sidebar

Related Questions

I am building an iPhone app using jQuery Mobile, jQuery 1.7.2, and PhoneGap trying
I'm building an app that allows users to snap pictures using the iPhone camera,
I'm building an app which is a universal iPhone/iPad app. I'd like to support
I am building an iPhone app that has some default data inside it via
I'm building an iPhone App leveraging RestKit to pull/push data to a remote API.
I'm building an iPhone app that aggregates data from several different data sources and
I am currently building an Iphone app that is using storyboards. I know how
how do you make the Iphone app run as 2X on Ipad automatically? Building
Building an iPhone app, using: Xcode 4.1 Base SDK iOS 4.3 Apple LLVM Compiler
I'm building an iPhone app using Titanium Mobile and using the HTTPClient. Whenever I

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.