Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// basic event click handler
event(document.getElementById("link"))("click")(function(){
console.log("click!")
})
/**
* Attach and Detach Handlers
*/
// attach handler
var linkclick = event(document.getElementById("link"))("click")(function(){
console.log("click!")
})
// detach handler
linkclick()
/**
* Multiple events from one selector
*/
var el = event(document.getElementById("link"))
// click handler
el("click")(function(){
console.log("click")
})
// mouseover handler
el("mouseover")(function(){
console.log("mouse over!")
})
/**
* Multiple handlers for same event
*/
var onclick = event(document.getElementById("link"))("click")
onclick(function(){
console.log("clicked!")
})
onclick(function(){
console.log("me too!")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.