Here's a simple example:
document.getElementById("input-field1").addEventListener("cocoon:after-insert", () => {
document.getElementById("input-field2").dispatchEvent(new Event("input"));
})
The dispatchEvent doesn't work on any cocoon callback.
A workaround is to place the dispatchEvent inside a setTimeout function
document.getElementById("input-field1").addEventListener("cocoon:after-insert", () => {
setTimeout(() => {
document.getElementById("input-field2").dispatchEvent(new Event("input"))
}, "5");
})
Not sure if that's an expected behavior or a bug.
Here's a simple example:
The dispatchEvent doesn't work on any cocoon callback.
A workaround is to place the dispatchEvent inside a setTimeout function
Not sure if that's an expected behavior or a bug.