Since the event is passed as the first argument, replace onclick="somefunction(event)"
with onclick="somefunction(arguments[0])
.
The alternative is to add an id attribute to the element and a script to add the eventListener, which has the potential of introducing bugs, and is laborious on a large code base.