JS - onchange event

0 votes
122 views
added May 16, 2019 in Javascript by LC Marshal Captain (25,770 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.
...