MyTitle MyTitle - 4 months ago 9x
Java Question

Determine "Backspace" button pressing

How to determine in GWT that user pressed Backspace button? I tried this, but it does not work

public void onKeyPress(KeyPressEvent event) {
char charCode= event.getCharCode();
if(charCode == (char) KeyCodes.KEY_BACKSPACE){
//do someThing


The keypress event is implemented in most browsers as only firing when a character would be produced (and that's how it's being standardized: ). Backspace obviously doesn't produce a character; you should use keydown or keyup to detect it.