0

I am using jquery mobile and I have an annoying issue... When an element has a link, for example a button, I am catching events like touchEnd event to fire then javascript calls or prevent link. However, when a long press button (1 or 2 seconds), ALWAYS executes the link! Tested on iOS5 and Android and tried several possibilities but problem remains! For example, following code should prevent link and it does if you click "fast" at button. However, if you press button and hold it (touchend is not fired), link is also executed! Also if you do not handle any event. Thank you

$(document).ready(function() 
 {
  $("a").bind('touchend', function(event)
  {      
          event.stopImmediatePropagation();
          event.preventDefault();
  }

EDIT: problem comes from tabhold event that always fire link although this event is used or not! Definetely seems a bug and possible solution could be set its time to infinite. How?

3
  • Have you tried onMouseUp event instead of touch event?
    – nhahtdh
    May 25, 2012 at 8:54
  • What happens when you bind to touchstart?
    – codaniel
    May 25, 2012 at 9:02
  • touchstart is fired and I can prevent link but then, if keep pressing tabhold is also triggered and goes to link. Please see Edits
    – Jaume
    May 25, 2012 at 10:48

1 Answer 1

0

Please report a bug on the jquery-mobile site https://github.com/jquery/jquery-mobile/issues

Ideally make an example app that shows the bug from this template: http://jsbin.com/otepum/edit#html

I recently reported a similar bug, which is that cmd+click on a link doesn't open in new window (obviously not a problem on actual touch screens)

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.