Hello,
I have an html where I want to hide or display some fields according to the button radio
selected. But it has not worked, I would like some help. Here is the code:
<script>
$( document ).ready(function() {
$("#input-custom-field2, #input-custom-field3, #input-custom-field4, #input-custom-field5, #input-custom-field6").hide();
});
$("input:radio[name=custom_field-account-1]").on("change", function () {
if($(this).val() == "1")
{
$("#input-custom-field2, #input-custom-field3").show();
$("#input-custom-field4, #input-custom-field5, #input-custom-field6").hide();
}
else if($(this).val() == "2")
{
$("#input-custom-field4, #input-custom-field5, #input-custom-field6").show();
$("#input-custom-field2, #input-custom-field3").hide();
}
});
</script>
<div class="radio">
<label>
<input type="radio" name="custom_field[account][1]" id="id-custom_field-account-1-1" value="1">
Pessoa Física
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="custom_field[account][1]" id="id-custom_field-account-1-2" value="2">
Pessoa Jurídica
</label>
</div>
<input type="text" name="custom_field[account][4]" value="" placeholder="Razão Social" id="input-custom-field4" class="form-control" vk_1bc56="subscribed">
<input type="text" name="custom_field[account][5]" value="" placeholder="CNPJ" id="input-custom-field5" class="form-control" vk_1bc56="subscribed">
<input type="text" name="custom_field[account][6]" value="" placeholder="I.E" id="input-custom-field6" class="form-control" vk_1bc56="subscribed">
<input type="text" name="custom_field[account][3]" value="" placeholder="RG" id="input-custom-field3" class="form-control" vk_1bc56="subscribed">
<input type="text" name="custom_field[account][2]" value="" placeholder="CPF" id="input-custom-field2" class="form-control" vk_1bc56="subscribed">