Posts Custom Events in JavaScript
Post
Cancel

Custom Events in JavaScript

http://www.kirupa.com/html5/custom_events_js.htm

1
2
3
4
5
6
7
8
document.body.addEventListener("myEventName", doSomething, false);

function doSomething(e) {
    alert("Event is called: " + e.type);
}

var myEvent = new CustomEvent("myEventName");
dodocument.body.dispatchEvent(myEvent);

origin - http://www.pipiscrew.com/?p=2572 js-custom-events-in-javascript

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags