two input boxes, listen for the keydown event to one of the input boxes, and assign its value to the other box, but the value is always one bit less, so there is no problem with the keyup event
<div class="test">
<input class="test1" type="text" name="test1">
<input class="test2" type="text" name="test2">
</div>
<script type="text/javascript">
var test1 = document.getElementsByClassName("test1")[0];
var test2 = document.getElementsByClassName("test2")[0];
test1.addEventListener("keydown", function(e) {
test2.value = e.target.value;
})
</script>