Skip to content

Instantly share code, notes, and snippets.

@felixzapata
Created May 13, 2014 06:40
Show Gist options
  • Save felixzapata/a711b31278dfcb41a908 to your computer and use it in GitHub Desktop.
Save felixzapata/a711b31278dfcb41a908 to your computer and use it in GitHub Desktop.
How to pass arguments to addEventListener listener function?
var someInput = document.querySelector('input');
someInput.addEventListener('click', myFunc, false);
someInput.myParam = 'This is my parameter';
function myFunc(evt){
window.alert( evt.target.myParam );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment