Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
You can use the dispatchEvent method. const inputField = document.querySelector("#example"); inputField.value = "X"; inputField.dispatchEvent(new Event('change')); jsfiddle
Answer
#1: Initial revision
You can use the [`dispatchEvent`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent) method. ```javascript const inputField = document.querySelector("#example"); inputField.value = "X"; inputField.dispatchEvent(new Event('change')); ``` [jsfiddle](https://jsfiddle.net/nh4szqeo/)