javascript - Name Attribute of Clicked Element -


How do I get the elements clicked using Java Script

My code:

  document.addEventListener ('click', function (e) {e = e || window.event; var elementname = e. ????; warning (elementname);}, false);  

If you use jQuery, you can do this:

$ (document). Click (function (e) {warning ($ (e.target) .attr ('name'))});

Comments

Popular posts from this blog

php - Select box validation (in laravel) -

Creating a sparse matrix in Matlab with a specified number of independent Bernoulli +-1 nonzero entries -

pandas - Iterate on Groupby Object's fields -