How do I check if all selects have been selected?
First I check if it is different from select, the user needs to check a different option than "select".
Then I need to check that all selects are different from "select"
While not different from "select" I can not send the form.
My jQuery:
$('#results-answers').children('select').each(function(){
if ($(this).val() != "Selecione"){
$('#results-answer select').removeClass('flagError');
}
else{
$('#results-answers select').addClass('flagError');
return false;
}
});
This is the html with one of the selects (it's currently 5, but it can dynamically vary the amount since it comes from an ajax)
<div class="" id="results-answers">
<select class="form-control answers" id="1">
<option>Selecione</option>
<option value="true" data-question-code="1">Sim</option>
<option value="false" data-question-code="1">Não</option>
</select>
</div>