keypress only because older plus2net code used it. New code should normally use keydown or input.const source = document.getElementById('t1');
const output = document.getElementById('t2');
source.addEventListener('keypress', () => {
output.value = source.value;
});
Replace 'keypress' with 'input' when the real requirement is to copy the current text after any edit.
Event Handling · getElementById() · First legacy demo · keypress tutorial · Mouseover