How to get the id or other attribute value of element that caused event?

How to get the id or other attribute value of element that caused event?

Assuming I have a set of elements with the same function attached, how do I get the ID or other attribute value of the element that caused the function to be called?