Text area on change and on key press don't work as expected

Hello,

I am trying to capture the change and key press events on a text area but both don’t seem to behave as expected.

For onChange event: It doesnt get trigerred unless the focus is removed from the textarea

For onKeyPress event: It always the captures the value of one key press in the past for e.g. if I type ‘1234’ in the text area and do a $$(‘textarea’).getValue() it will give me ‘123’

You can see the behavior on this following snippet:
https://snippet.webix.com/3jt99r60

I would appreciate any help with this.

Hello @kchhatani ,
The point is that onKeyPress fires before the value is updated.
So it’s better to use onTimedKeyPress event which fires after typing has been finished in the field.
The onTimedKeyPress event is just the same onKeyPress event but with a 250-ms timeout.
So you can freely use it, read the information from key and event parameters and perform the required actions with another timeout:
https://snippet.webix.com/0k62xsss

@annazankevich Thanks a lot, that works great.