keypress is deprecated. This page keeps the behavior so older code is understandable.const source = document.getElementById('t1');
source.addEventListener('keypress', () => {
output.value = source.value;
});
source.addEventListener('input', () => {
output.value = source.value;
});
Event Handling · getElementById() · Second legacy demo · keypress tutorial · Mouseover