I just wrote a confirm delete function that requires a class name:
jQuery(document).ready(function($) {
$('.ConfirmDelete').click(function() {
var question = $(this).attr('title');
if (question == '') question = 'Delete this record?';
return confirm(question);
});
});
Usage:
<input name="Delete" type="submit" value="Delete" class="ConfirmDelete" title="Delete #UsrName#?" />
I'd like to change the selector from .ConfirmDelete to something like:
$('input:submit').attr('name','Delete').val('Delete')
Meaning: If a submit button has the name 'Delete' and it's value is 'Delete', then go ahead and assume they want to confirm the delete without requiring them to have a ConfirmDelete class.