Hi,
I have the following code in jQuery that updates a div in real time as the user changes the value of #myinput text field:
$('#myinput').bind('change paste keyup', function() {
// Do something...
}
and I want to write it in pure JavaScript. I tried a couple of things including the following with no success:
document.getElementById('myinput').addEventListener('keydown', function() {
// Do something...
}
The above works buggy, doesn’t give correct results, and not actually in real time as compared to the jQuery code I use.
Any ideas how I convert the jQuery code I have to pure JS and work exactly the same?
Thanks.