I had success using jQuery (in Chrome). If you hold the key down, it takes into account each change, not just the first, and it treats non-printable keys as a backspace.
HTML
<input id="txt" type="text" /> <span id="changeCount">0</span>
Javascript
$('#txt').keydown(function(event) {
As I said above, you will want to filter out all key codes that do not change the text, for example ctrl , shift , alt , enter , etc. In addition, the boundary condition is if you press the backspace or delete key when the text field is empty or if the text field has the maximum length and the key is pressed for printing, but this is also not difficult to handle.
Here is a working jsfiddle example .
FishBasketGordo
source share