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

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -