1

In jQuery you can bind two events to one jQuery object. How do I stop the second event from firing once the first one is initiated? If I click on my element, touchstart fires right away. But if I keep my finger held down on the element, then the click will fire. I only want the touchstart to fire and then stop. The problem is that it's running my function twice in a row.

$(document).on("touchstart click", ".bluePill", function (e) {e.stopPropagation();});
Alex
  • 1,112
  • 4
  • 16
  • 30

1 Answers1

0

You have to use this one: http://api.jquery.com/event.stopImmediatePropagation/

DzikiMarian
  • 423
  • 3
  • 14
  • That does not work. The click still fires. (as well as the touchstart) And my function fires twice. – Alex Jun 28 '12 at 19:05
  • Looks like my solution to this problem is not as simple as stopImmediatePropagation() http://stackoverflow.com/questions/8503453/click-event-called-twice-on-touchend-in-ipad – Alex Jun 28 '12 at 19:26