The addEventListener method is the one you want.
The on* properties, like onclick, were always a bit of a blunt instrument, overwriting any previous handler. addEventListener allows for multiple handlers, which is essential for modular design.