How to get the value otido in a function and put in a text, JavaScript?

1

I can show no alert but I'll put it in the text (temp2), it will not!

    function mostrarValor(){
         var escalaEntrada = getRadioValor('escalaEntrada');
         var escalaSaida = getRadioValor('escalaSaida');
         var valor = parseInt(document.getElementById("temp1").value);
    if (escalaEntrada === "celsius" && escalaSaida === "kelvin") {  
            resul = (valor + 273);
            window.alert(resul);
            /*var saida = document.getElementById("temp2");
            saida.innerHTML = resultado;*/

        }
     }
    
asked by anonymous 26.05.2016 / 21:03

1 answer

0

The elements input do not have innerHTML since they are self closing (auto closed).

You should use the .value property to change the value.

    
26.05.2016 / 22:40