Code: Select all
<form onSubmit="return confirmDeletions();">
<input type="checkbox" name="del[]" id="del[]" />
<input type="checkbox" name="del[]" id="del[]" />
<input type="submit" />
</form>
Code: Select all
function confirmDeletions() {
var del = Array(document.getElementById('del[]'));
var conf = false;
alert('length: ' + del.length);
for(var x=0; x < del.length; x++)
{
if(del[x].value != null)
{
alert(del[x].value);
conf = true;
}
}
if(conf == true)
return confirm('Are you sure you want to delete the selected waiters?');
return true;
}
I know that I am grabbing the array of checkboxes incorrectly (because the length should be 2), can someone point me in the right direction? Google brings up nothing except for how to handle the document.forms array and the elements array.