1
How I check if all selects have been selected?
First I check if it is different from select, user needs to mark a different option from "select".
Then I need to check that all selects are different from "select"
While not different from "select" I can not submit 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 html with one of the selects (there are 5 currently, but it can dynamically vary the amount as 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>