Code: Select all
$('#section_3 button').live('click', '#section_3 button', function(e){
e.preventDefault();
var msg = "The following files will be deleted:\n";
var flag = false;
$('#section_2 li input[type="checkbox"]').each(function(){
if($(this).attr('checked')){
msg += '- '+$(this).attr('value')+"\n";
flag = true;
}
});
msg += "\nContinue?";
if(flag){
var response = confirm(msg);
if(response){
alert('File(s) deleted.');
$('#main').submit();
}else{
alert('Delete cancelled.');
return false;
}
}
$('#main').submit();
});What's the trick here? I'm obviously doing something wrong and I suspect it's got something to do with how I've handled everything with e.preventDefault()...
Any insight into this would be appreciated (apologies in advance if this has been covered countless times before)...