Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pass argument to event listener javascript

someObj.addEventListener('click', some_function(someVar) );

const some_function = (someVar) => {
  	return (e) => {
      console.log(someVar)
      console.log(e)
    }
}
 
PREVIOUS NEXT
Tagged: #pass #argument #event #listener #javascript
ADD COMMENT
Topic
Name
6+2 =