I am trying to add click event listener to my divs that I am creating in my JS dynamically.
My Javascript snippet of function that is called each time to create the Div:
var listDiv = document.createElement("div");
listDiv.className = "list";
listDiv.addEventListener = ('click',gotoOutcomesLO, false);
The Function that is called by the click event:
function gotoOutcomesLO(e){
if(typeof(Storage)!=="undefined"){
var ele = e.target;
var text = ele.getAttribute("name");
sessionStorage.test = text;
}
}
I don't see any click events added to my HTML and not sure what's wrong. Any pointers would be helpful! Thanks!
=inlistDiv.addEventListener = ('click',gotoOutcomesLO, false);