Javascript: Como enviar evento após alterar <input> programaticamente sem JQuery

Este snippet alterará um input programaticamente e então despachará um evento input que dirá ao código javascript rodando na página que o input foi alterado.

dispatch_input_event.js
let myinput = document.querySelector("input#myinput");
// Set value
myinput.value = "newvalue";
// Simulate input event
myinput.dispatchEvent(new Event('input', {
    bubbles: true,
    cancelable: true,
}));

Check out similar posts by category: JavaScript