[ad_1]
When I type something it gets delayed by one keypress. for example if I type h
, it would be blank, if i type helloworld
it would be helloworl
. If I have sad
displayed, I would have to press backspace twice to get to sa
instead of once. Why is there this delay? How do I fix it?
HTML:
<input type="text" id = "new"></input>
<p id = "result"></p>
<script src = "script.js" type = "module"></script>
javascript:
var search = document.getElementById("new");
var resultbox = document.getElementById("result");
search.addEventListener("keydown", function(){
resultbox.innerHTML = search.value;
})
[ad_2]