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

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -