Javascript global onclick listener
You can get id this way using javascript:
window.onclick = function(event) {alert(event.target.id);}
<div id="dID">div</div>
<button id="bId">Button</button>
<input type="text" id="txtId" class="txtclass" />
document.addEventListener("click", function(evnt){
console.log(evnt.target.id);
});