I have a link that I would like to present with a confirmation. I am using the javascript confirm()
method. But the only way for me to get the link to not work when the user clicks 'cancel' is to use return false;
. Is that the correct way to do it (cross-browser)?
$('a.confirm').click(function() {
if(confirm('Are you sure? This cannot be undone.')) {
return true;
}
return false;
});