jQuery tabs, prevent navigating away with preventDefault() not working
Hi all,
I am checking if a form on a jQuery tab is changed, and if it has, the user should get a popup warning when they navigate away from the tab with the form or click any other link on the page for that matter. So I setup this code:
- $('a').bind('click', function(event) {
- if (formChanged == true) {
- event.preventDefault()
- console.debug('prevent');
- }
- });
in the $(document).ready() function. I can see the code is executed, but the click on the link still comes through and the form is lost. I've tried .click() and .live('click') as well but that doesn't work either. What am I missing ?
Thanks much.