You can try something like below.
const myInput = document.getElementById('input'); // Input Element with id="input"
const myOutput = document.getElementById('output'); // An empty paragraph with id="output"
function handleInputKeypress(e) {
myOutput.textContent = e.target.value;
}
myInput.addEventListener('keyup', handleInputKeypress);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…