из span в input

хотел бы задать вопрос, как значение span передать в input(забыл)

<input type="range" min="-50" max="50" value="0" class="slider" id="myRange" step="0.01">
        
        <p>Value: <input value="0" class="slider1" id="myRange1" step="0.01"><span id="demo" style="opacity: 1"></span></p>

var slider = document.getElementById("myRange");
            var output = document.getElementById("demo");
            output.innerHTML = slider.value;
            slider.oninput = function() {
                output.innerHTML = this.value;
                rootar1.position.x = parseInt($('myRange').value)
            }

Ответы (1 шт):

Автор решения: Voprositel

const input = document.querySelector('input');
const span = document.querySelector('span');

input.addEventListener('input', ev => {
  span.textContent = ev.target.value;
});
<input type="text">
<span>Какой-то текст</span>

→ Ссылка