Skip to content

Instantly share code, notes, and snippets.

@LeipeLeon
Created December 20, 2010 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeipeLeon/748235 to your computer and use it in GitHub Desktop.
Save LeipeLeon/748235 to your computer and use it in GitHub Desktop.
<%= image_submit_tag "button_volgende_stap.gif", :title=> t('form.submit'), :onclick => "needToConfirm = false;" %>
<% content_for :page_js do %>
<script>
var needToConfirm = false;
window.onbeforeunload = confirmExit;
function confirmExit() {
if (needToConfirm) {
return "U heeft onbewaarde wijzigingen. Doorgaan?";
}
}
$('.btn a').live('click', function() {
needToConfirm = true;
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment