function addEventListenerToElement(element, event, handlerFunction) {
if(element.addEventListener) {
element.addEventListener(event, function(){
handlerFunction(this.getAttribute("src"));
}, false);
}
}
//initialize the function
addEventListenerToElement(".Dicon", "click", handleClick);
function handleClick(){
console.log("Clicked");
}
I am using this function to enable my image click functionality, but I don't want someone to repeatedly spam clicks on it. How can I prevent users from continuously clicking it?