I'm trying to add a onclick event to a tag, but it isn't working. Can anyone tell me the correct way to add an onclick to this tag in js?
var cell = result.appendChild(document.createElement('abbr')); cell.title = "cell number 1"; cell.className = 'chart-cell-type'; cell.addEventListener='onclick',(alert("clicked!")); //broken
addEventListeneris a method that takes two parameters, a string and a function.