1 votes

How to pass the value of a button to an input?

I want to pass the value of a button to an input but I have not been able, I am learning. I have looked for information but cannot find it.

 <button type="button" id="boton" value="7">7</button>

<input type="text"  id="resultado">
   var boton = document.getElementById('boton');
  var resultado = document.getElementById('resultado');

    boton.onclick = function(e){
      resultado.textContent = resultado.textContent  + "7";

(Literal) Pass that 7 to the input.

Thanks in advance


HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by: