0
I’m not able to verify if at least one checkbox was checked before giving Ubmit in the form.
I saw that you have some questions similar to mine, but none of the solutions worked out for me
I used the following code and it’s not working:
$("#funcoes_cursos").submit(function(){
var cursos = $("#funcoes_cursos input[name='cursos[]']").val();
if(cursos == "" || cursos === undefined){
alert('Selecione um ou mais cursos para deletar');
return false;
}else {
if( !(confirm("Ao deletar um curso, todos os dados relacionados a ele também serão deletados. Deseja realmente deletar o curso?")) ) {
return false;
}
}
});
Inputs are in format:
<input type="checkbox" name="cursos[]" value="">
My idea is that before sending the form to page that deletes the selected courses, it checks if at least one course is selected. But the way it is, it doesn’t take the input value.