How can I validate the code below with 2 alerts?
The first check is that at least 1 checkbox is selected - if not, alert a message saying "Please select at least 1 checkbox!". The second should alert "Are you sure you want to delete?" and submit:
SCRIPT:
<script type="text/javascript">
$(document).ready(function() {
$("#delete").click(function()
{
if (confirm('Are you sure you want to delete?')) {
$('#form_test').submit();
}
});
});
</script>
HTML:
<a id="delete" href="#">Delete Images</a>
<form id="form_test" method='post' action=''>
<input type="checkbox" name="remove[]" />
<input type="checkbox" name="remove[]" />
</form>