Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Another Example In JavaScript Event Delegation

	function delegate(el, selector, fn)
	{
		el.addEventListener("click", function(){
			if(event.target.matches(selector))			
{
	fn()
}
		})
}
	window.onload = function(){
		let first = document.getElementById("first");
		delegate(first, "button", function(){alert("DFREXXXXXXXXX")});
}
 
PREVIOUS NEXT
Tagged: #Another #Example #In #JavaScript #Event #Delegation
ADD COMMENT
Topic
Name
9+4 =