That opton is the best cause will catch the value updated, instead of using 'keydown' who just gets the value without the last char typed
element.addEventListener("keyup", () => { console.log(element.value) })