I have a back button on a navigation bar at the top of the page enabled with:
<div data-role="page" id="chat" data-add-back-btn="true">
I would like to call a javascript method when the back button is clicked, but without removing the back functionality. I was trying to create my own back button and then call to javascript:history.back(1) but I prefer to keep the original button.
Thanks
You cannot prioritize jQuery events, and jQuery events stack. So you have two options, one is to daisy chain your ordering of events (callbacks), the other is to remove the default behavior and overwrite the event.
What you might want to do is
event.preventDefault()followed by your code and then do ahistory.back(1):