document.addEventListener('click', function(e){ var anchor = e.target.closest('a'); if(anchor !== null) { //do something with a tag } });