How to use JS functions

I’ve struggled to use onkeyup function since it is not available.

All can I do is use onkeypress but is not useful to me because this function does not take the last insterted value. How can I use common JS functions? Do I have to import some libraries? Which ones?

Use onKeyPress with an unnoticeable timeout:

$w("#input").onKeyPress(event => {
    setTimeout(() => {
        //do whatever you wish
    },30);
})

Thanks a lot!!!

Also, the onInput() event handler is triggered when the input element receives input, and gives the updated value:

$w("#myElement").onInput( (event) => {
    let newValue = event.target.value;  // "newValue"
} );

Amazing!!! Thank youuu

@alemartinezit Just be aware the onInput() currently does not work with Rich Text element. For that case use onKeyPress with timeout (+ in cases where you need to detect non value key press such as the Enter key), otherwise the oninput will be better as it also detects copied-pasted inputs.