I have a text input and a handler routine testFunc(input.value)
testFunc should be called when
- When a alphabet key is pressed
- when backspace is hit with updated value (i.e when initial input is 1234, when backspace is hit from the end, input should be 123 to the testFunc routine)
- If the input is 1234, and backspace is hit from somewhere in the middle i.e 1234, then the testfunc should be called as testFunc(234).
- 2, 3 should be similar for DELETE key too.
I tried with onkeypress and onkeyup, but some how testFunc handler routine is not getting with the updated value (or) testFunc routine itself is not getting called.
Can any one let me know how i can resolve this issue or whether there is any existing APIs in Javascript