I have a window.onbeforeunload check for dirty form that works well.
window.onbeforeunload = function () {
'use strict';
if (isDirty === 1) {
return 'You have unsaved changes';
}
};
I would like to call this when users click on a tab, our tab call look like the following
<li><a href="#scheduling-tab" onclick="return schedulingTabGet('CRFilingScheduling.do', null);">Scheduling</a></li>
The schedulingTabGet code is in another file it is as follows:
function schedulingTabGet(url, formId) {
return getTab('#scheduling-tab', url, formId);
}
function getTab(tabId, url, formId) {
jQuery.get(url, jQuery(formId).serialize(), function (data) {
jQuery(tabId).html(data);
});
return false;
}
I tried the code sample from JQuery onchange in tabs event but it wouldn't work. I am not sure if that is a little different case. Any suggestions?
Thanks,
Tom