To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
Backspace Shortcut, but continue with browser event
7 years ago Jan 20, 2016 12:56am
I am handling a backspace keypress with a shortcutlistener. I am performing an action, but want not disable the default browser action. How can I achieve this?
Ex. I have a textfield, on backspace keypress, I check the textfieldvalue, if empty i perform an acation. This has to happen on the backsppace keypress. If it is not empty, i let the browser remove the last character, like normal.
While typing this, I realized I could add a valuechangelistener, if null, add the backspace listener. if not null, remove the backspace listener. ---- Is this the only way??