I have two radio inputs
<input id="tab-1" type="radio" value="juridica" name="tab" class="sign-in"><label for="tab-1"class="tab">Jurídico</label>
<input id="tab-2" type="radio" value="fisica" name="tab" class="sign-up" checked="checked"><label for="tab-2"class="tab">Físico</label>
and I want to do a check for which is selected, by default, the physical is already checked.
if ($("#tab-1").prop("checked")){
document.getElementById('cpf').required = true;
document.getElementById('nome-completo').required = true;
document.getElementById('cnpj').required = false;
document.getElementById('razao-social').required = false;
} else {
document.getElementById('cpf').required = false;
document.getElementById('nome-completo').required = false;
document.getElementById('cnpj').required = true;
document.getElementById('razao-social').required = true;
}
however, it is not working. When I select the legal does not work. It works just for the physicist, which is already pre-selected.