Skip to content

Instantly share code, notes, and snippets.

@otar
Created September 11, 2012 08:57
Show Gist options
  • Save otar/3697031 to your computer and use it in GitHub Desktop.
Save otar/3697031 to your computer and use it in GitHub Desktop.
jQuery Confirmations
$(function()
{
$('a[rel="confirm"]').on('click', function(event)
{
var message = !$(this).data('confirm')
? 'Are you sure you want to do this?'
: $(this).data('confirm');
if (!confirm(message))
{
event.preventDefault();
return false;
}
return true;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment