javascript get element user clicked code example
Example 1: how to get the text of a clicked elemet by javascript
document.addEventListener('click', function(e) {
e = e || window.event;
var target = e.target || e.srcElement,
text = target.textContent || target.innerText;
}, false);
Example 2: how to get the text of a clicked elemet by javascript
$(document).click(function(event) {
var text = $(event.target).text();
});