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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:50:23+00:00 2026-06-09T13:50:23+00:00

I am developing an app for iOS using Phonegap bundled with jQuery Mobile 1.1.1.

  • 0

I am developing an app for iOS using Phonegap bundled with jQuery Mobile 1.1.1. I have a div on my page that is listening for both tap and taphold events.

The problem I am facing is that the tap event is fired after the taphold event once I lift my finger. How do I prevent this?
A solution is provided here but is this the only way to do this? Kinda nullifies the whole point of having two different events for tap & taphold if you need to use a boolean flag to differentiate the two.

Following is my code:

$('#pageOne').live('pageshow', function(event) {
    $('#divOne').bind('taphold', function (event) {
       console.log("TAP HOLD!!");    
    });

    $('#divOne').bind('tap', function () {
      console.log("TAPPED!!");
    });
});

Would greatly appreciate the help. Thanks!

  • 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-09T13:50:24+00:00Added an answer on June 9, 2026 at 1:50 pm

    [Tried and Tested]
    I checked jQuery Mobile’s implementation. They are firing the ‘tap’ event after ‘taphold’ every time on ‘vmouseup’.

    Workaround would be not to fire the ‘tap’ event if the ‘taphold’ has been fired. Create a custom event or modify the source as per you need as follows:

    $.event.special.tap = {
        tapholdThreshold: 750,
    
        setup: function() {
            var thisObject = this,
                $this = $( thisObject );
    
            $this.bind( "vmousedown", function( event ) {
    
                if ( event.which && event.which !== 1 ) {
                    return false;
                }
    
                var origTarget = event.target,
                    origEvent = event.originalEvent,
                    /****************Modified Here**************************/
                    tapfired = false,
                    timer;
    
                function clearTapTimer() {
                    clearTimeout( timer );
                }
    
                function clearTapHandlers() {
                    clearTapTimer();
    
                    $this.unbind( "vclick", clickHandler )
                        .unbind( "vmouseup", clearTapTimer );
                    $( document ).unbind( "vmousecancel", clearTapHandlers );
                }
    
                function clickHandler( event ) {
                    clearTapHandlers();
    
                    // ONLY trigger a 'tap' event if the start target is
                    // the same as the stop target.
                    /****************Modified Here**************************/
                    //if ( origTarget === event.target) {
                     if ( origTarget === event.target && !tapfired) {
                         triggerCustomEvent( thisObject, "tap", event );
                     }
                }
    
                $this.bind( "vmouseup", clearTapTimer )
                    .bind( "vclick", clickHandler );
                $( document ).bind( "vmousecancel", clearTapHandlers );
    
                timer = setTimeout( function() {
                    tapfired = true;/****************Modified Here**************************/
                    triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) );
                }, $.event.special.tap.tapholdThreshold );
            });
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a native mobile app for Android and iOS using PhoneGap.I have a
I am developing iOS app using phonegap. Users first have to register or log
I'm developing an iOS app. Its working properly on simulator. I'm using phonegap and
I'm developing an iOS app using Core Plot headers. I have different UI for
I am developing and iOS app with both positions, Landscape and Portrait. Using iOS5,
I am developing an iOS app using XCode 4.2 I have a UIImage variable
I'm currently using PhoneGap for a mobile app I'm developing. In my Login screen,
I'm developing an iOS app using Core Data. And I have a Log entity
I'm developing a mobile application using Backbone, jQueryMobile and Phonegap. The app works great
I'm developing an iOS app with Twitter features. To do that I'm using SA_OAuthTwitterEngine

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.