I have a problem needing 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 it should check the checkboxes 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>