0
I have a problem I need to check if a checkbox is selected. I happen to have a form with values that are loaded by ajax requests to the server. after having the data loaded is that he should check the checkbox as I do this, I have to see if the select was empty before.
if (document.getElementById('trabalho').checked) {
}
<div class="col-xs-12 col-md-3">
<input type="checkbox" name="trabalho" value="trabalho" checked="true" id="trabalho">Trabalho </input>
<input type="checkbox" name="residencia" value="residencia" id="residencia">Residência</input>
<select class="form-control" placeholder="Residencia" id="opcao" sytle="display: none!important;">
<option value="todos" selected="selected"> Todos</option>
<option value="1antes">1 ano antes</option>
</select>
</div>
Hello, Unfortunately I didn’t understand your question. Can try to put an example?
– Tiago Gomes
Your condition already returns true if the checkbox is selected. da to put a better example?
– Gabriel Rodrigues
yes already this selected I have two and switch between the two, is to generate a chart..
– usersantos