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
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow