-1
I’m trying to get the selected radio to change the default value of an input time I checked that with javascript or jquery I can but I can’t do it the way I need to.
I have 3 Radio and 1 input time.
If the radio selected is output, it must contain the standard value 17:30 If the default value is entered it should be 08:00 in case of clearance should contain default value of 00:00 (this option should be blocked for change)
var campoHora = document.querySelector('input[type="time"]');
    case '1':
                document.getElementById( 'tipo' ).innerHTML = 'entrada';
                document.campoHora.value="10:00";
                break;
                case '2':
                document.getElementById( 'tipo' ).innerHTML = 'saida';
                document.campoHora.value= "12:00";
                break;<div class="container"> <!-- 3 + 6 + 3 = 12 -->
    <div class="col-md-4"><font color="red">DATA</font>
    </br>
    <div id="campos">
    <input id="date" type="date">
    </div></div>
    <div class="col-md-4"><font color="red">SAÍDA/ENTRADA/FOLGA</font>
    <div id="time">
        <input type = "radio" name = "tipo" id="entrada" value = "entrada" style="margin-top:15px;"/> Entrada
        <input type = "radio" name = "tipo" id="saida" value = "saida" style="margin-top:15px;" /> Saída
        <input type = "radio" name = "tipo" id="folga" value = "folga" style="margin-top:15px;" /> Folga
    </div></div>
    <div class="col-md-4"><font color="red">Horas</font></br>
    <input id="time" name="time" type="time" value="" /></div>
</div>
You could also add the JS code you tried to do and describe the obtained result?
– Woss
Edited,he returns nothing in this case.
– Noscin
Are you sure you copied the right code? The JS you put is very strange, with the syntax quite wrong; there are several
caselost, without having the proper control structures. If this is really the code you tried to do, I strongly recommend that you review the syntax of the language before continuing.– Woss