After using the .innerHTML to prench a DIV, how to clear this div with another function?

0

I have the following code,

var resultado;
    var numero;
    var tamanhoNumero;
    var i=0;
    function calcular(){

        numero = document.form.numero.value;
        console.log(numero);
        tamanhoNumero = numero.length;
            console.log("i = " + i);

        for (i = tamanhoNumero; i>=0; i--) {
            console.log("i = " + i);

            console.log("numero.lenght = " + numero.lenght);
            resultado += numero.substring(i, i-1) + '<br>';
        }

        document.getElementById('saida').innerHTML = resultado;
    }

When I fill in the 'output', I would like to clean it before the next operation, this can be done at the beginning of this same function. How to do?

    
asked by anonymous 25.10.2017 / 00:35

1 answer

0

Other similar ways to remove text from a tag without other child elements would be:

elemento.removeChild(elemento.firstChild);

or

elemento.removeChild(elemento.lastChild);
    
25.10.2017 / 01:54