I have function with onkeydown() event and get value length of input text, when I press ctrl+a / block a text (with 5 character) on it and type single character but **ouput value length of input is 4 instead 0.
function typeInput(that) {
  console.log($(that).val().length);
}<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" onkeydown="typeInput(this)"> 
     
    