JSFiddle - React, Tailwind, and code Playground

by gustavox

HTML

<label class="radio" for="Csaldsim">
        Sim
        <input type="radio" id="Csaldsim" onclick="esconderradio('Csaldim', 'salvenc')"></label>
    <label class="radio" for="Csaldnao">
        Não
        <input type="radio" id="Csaldnao" onclick="onclick="esconderradio('Csaldim', 'salvenc')"></label>

<br>


<br>
<label class="radio" for="Csaldsim2">
    Sim
    <input type="radio" data-toggle="radio" name="Tsald" id="Csaldsim2" onclick="HabCampos32()"></label>
<label class="radio" for="Csaldnao2">
    Não
    <input type="radio" data-toggle="radio" name="Tsald" id="Csaldnao2" onclick="HabCampos32()"></label>
<br>
    <div  class=" col-md-3 panel panel-default" id="salvenc" style="display:none;">
        <label class="btn" for="Csalvenc">
            <input type="number" class="form-control" name="Tsalvenc" id="Csalvenc"></label>
    </div>
<br>
<div  class=" col-md-3 panel panel-default" id="salvenc2" style="display:none;">
    <label class="btn" for="Csalvenc">
        <input type="number" class="form-control" name="Tsalvenc" id="Csalvenc2"></label>
</div>

JavaScript

var esconderradio = function(var1, var2) {
    
        if (document.getElementById(var1).checked) {
            document.getElementById(var2).style.display = "";
        }
        else {
            document.getElementById(var2).style.display = "none";
        }
    };