I\'m currently trying to write some JavaScript to get the attribute of the class that has been clicked. I know that to do this the correct way, I should use an event listene
You can use the code below:
document.body.addEventListener('click', function (evt) { if (evt.target.className === 'databox') { alert(this) } }, false);