JS - onchange event

0 votes
added May 16, 2019 in Javascript by LC Marshal Captain (25,790 points)
// JS
document.querySelector('input').onchange = function(event) {
  document.querySelector('code').textContent = event.target.value;
<input type="text">
Your typed texts appear here: <code></code>  

<br><small>(hint: type anything in the text field and click out of the input to view the changes)


lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.