It’s easy to substract 1 from a variable every time a key is pressed. But sometimes people use the backspace, so then you detect what key it is, and in case of backslash, add 1 to your var.
But what if somebody selects half a sentence with the mouse and erases the whole chunck with one backspace stroke. How can I detect howmuch characters are gone? Or can I disable the use of mouse in an input textfield?