Consider a piece of code that looks like the following:
$(\'body\').on(\'click\', function(e){ });
I know there is a way to get the elemen
To get the attribute of a target element in JavaScript you would simply use:
e.target.getAttribute('id');
See also: https://stackoverflow.com/a/10280487/5025060 for the subtle distinction between DOM properties and their attributes.