-1
In the code below the function is executed in the event onchange="timesquare(this)"
from the select tag. How to replace this event with an onclick event on a button <button onclick="???????????;">Converter</button>
function timesquare(s) {
var optionsTime = (s[s.selectedIndex].id);
var convert = document.getElementById('convert').value;
if (convert < 60) {
document.getElementById('resultTime').innerHTML = "Escolha um valor acima de 60";
return;
}
switch(optionsTime){
case "minutes":
document.getElementById('resultTime').innerHTML = 'Vc escolheu minutos';
break;
case "hours":
document.getElementById('resultTime').innerHTML = 'Vc escolheu Horas';
break;
default:
document.getElementById('resultTime').innerHTML = "no result";
break;
}
}
<input type="text" id="convert" placeholder="Insira os segundos">
<br>
<select onchange="timesquare(this)" id="optionsTime">
<option></option>
<option id="minutes">Minutos</option>
<option id="hours">Horas</option>
<option id="teste">Teste</option>
</select>
<br>
<span id="resultTime"></span>
Just change the HTML to the response and add the javascript I mentioned.
– 13dev
edited response
– 13dev
already this all okay ? it happens , in peace we are here to help in whatever it takes!
– 13dev