I\'m looking to create a custom event in HTML, JS.
How can I create one such? \'
You want a CustomEvent
They should be easy to work with but browser support is poor. However the DOM-shim should fix that.
var ev = new CustomEvent("someString");
var el = document.getElementById("someElement");
el.addEventListener("someString", function (ev) {
// should work
});
el.dispatchEvent(ev);