I have a capture form, my problem is that when I want to see or edit some options I have them hidden if the user clicks on the radio activates other radios or text fields this works perfectly for me.
My question is how do I simulate the click event when filling out my form? since when filling it the radios that show hidden content are filled but they do not show me the hidden content, only if I give a manual click it is displayed.
this is my div with the radios and my function JS
<div class="form-group row">
<div class="col-sm-8">
4.- ¿Utiliza medidas de protección auditiva?
</div>
<div class="col-sm">
<div class="custom-control custom-radio custom-control-inline">
{{ Form::radio('aud_preg_4', 'S', ($cuestionario->aud_preg_4 == 'S'), array('id'=>'preg_4_s','class' => 'custom-control-input','required'=>'required')) }}
<label class="custom-control-label" for="preg_4_s">
Siempre
</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
{{ Form::radio('aud_preg_4', 'A', ($cuestionario->aud_preg_4 == 'A'), array('id'=>'preg_4_a','class' => 'custom-control-input','required'=>'required')) }}
<label class="custom-control-label" for="preg_4_a">
A veces
</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
{{ Form::radio('aud_preg_4', 'N', ($cuestionario->aud_preg_4 == 'N'), array('id'=>'preg_4_n','class' => 'custom-control-input','required'=>'required')) }}
<label class="custom-control-label" for="preg_4_n">
Nunca
</label>
</div>
</div>
</div> <!-- Pregunta 4 -->
<div class="form-group row d-none" id="preg_4_1">
<div class="col-sm-8">
4.1.- ¿Qué tipo de equipo de protección utiliza?
</div>
<div class="col-sm">
<div class="custom-control custom-radio custom-control-inline">
{{ Form::radio('aud_preg_4_1', 'T', ($cuestionario->aud_preg_4_1 == 'T'), array('id'=>'preg_4_1_t','class' => 'custom-control-input')) }}
<label class="custom-control-label" for="preg_4_1_t">
Tapones
</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
{{ Form::radio('aud_preg_4_1', 'O', ($cuestionario->aud_preg_4_1 == 'O'), array('id'=>'preg_4_1_o','class' => 'custom-control-input')) }}
<label class="custom-control-label" for="preg_4_1_o">
Orejeras
</label>
</div>
</div>
</div> <!-- Pregunta 4.1 -->
$('#preg_4_a').click(function() {
if($(this).is(':checked')) {
$('#preg_4_1').removeClass('d-none');
$('#preg_4_1').attr("required","required");
}
});
$('#preg_4_s').click(function() {
if($(this).is(':checked')) {
$('#preg_4_1').removeClass('d-none');
$('#preg_4_1_t').attr("required","required");
$('#preg_4_1_o').attr("required","required");
}
});
$('#preg_4_n').click(function() {
if($(this).is(':checked')) {
$('#preg_4_1').addClass('d-none');
$('#preg_4_1_t').removeAttr("required");
$('#preg_4_1_o').removeAttr("required");
}
});