As I was getting ready to add an onclick event to my element in JavaScript, a question popped into my mind regarding the efficiency of these two options:
document.getElementById(myid).onclick = function(e){...}
or
document.body.onclick = function(e){if(e.target.id == myid)...}
I'm curious if there is any difference between the two and whether one of them might be processed slower than the other. Any insights on this?