javascript get html element 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: javascript perform click
eventFire(document.getElementById('mytest1'), 'click');
Example 3: how to get the text of a clicked elemet by javascript
$(document).click(function(event) {
var text = $(event.target).text();
});