$(document).ready(function(){ $('input, select, textarea').change(function() { documentEditorUnsavedChanges = true; }); $('.btn-checkbox2btn').click(function() { documentEditorUnsavedChanges = true; }); $('a[href]:not([href^=#])').click(function(e) { if($(this).attr('target') == '_blank') return; if(!documentEditorUnsavedChanges) return; e.preventDefault(); var href = $(this).attr('href'); var html = [ '