Enter key start onblur event and not onkeyup/onkeydown
On my web I display configuration info, that user can edit, in a table.
The correct user behavior should be to press Enter key after editing the field in order to set the changes.
If he "leaves" the field without pressing Enter- the changes will be dismiss.
In order to do that- I use "onkeyup" and "onblur"
"onkeyup"
(1) set a flag that field's content has been changed
(2) if the key is Enter (==13) , it sends the server a set request with the current value
(*) also tried "onkeypress" or "onkeydown"
"onblur" - check the flag if the field's content has been changed. if so- send a refresh request to server that re-send current saved data (and erase user's changes).
I recently noticed that while it works great in Chrome, on Explorer pressing the Enter key sets both events, and sometimes only the "onblur" event, thus ignores user's requests....
Bookmarks