I am trying to create a navigation warning for unsaved data, but I am having trouble because the page that I am trying to check clears radio buttons. The way that the page clears them is by deleting the radio buttons and adding new ones. I do not know how to detect that using jQuery. I already have some code that detects changes in textboxes and it detects if the radio buttons have changed states but it doesn't work when they have been cleared. This is my jQuery:
var warnMessage = "You have unsaved changes on this page!";
$(document).ready(function() {
$('input:not(:button,:submit),textarea,select,:disabled').change(function () {
window.onbeforeunload = function () {
if (warnMessage != null) return warnMessage;
}
});
$('input:submit').click(function(e) {
warnMessage = null;
});
});
Is there a way to detect if document.add was used in the page?