I'm developing an application on Phonegap with a screen that has a Cancel button.
The Cancel button needs to have a click/tap event listener that cancels the form submission and returns to the previous page on the application.
The application needs to be compatible with both mobile devices (such as tablets) and modern day browsers. Which is why I listen for both click events as well as tap events.
This is how I have the event listener defined...
$(cancel_button).on('click tap', function(event)
{
// I assumed the following line would fix the issue, but it doesn't.
event.stopImmediatePropagation();
GoBack();
alert("Your submission has been cancelled.");
});
So when I click the cancel button on a browser it runs the code inside the listener about 6 times. Anyone have an idea on how to solve this?
Maybe try