I can't understand why so many websites use an onclick handler on a button to redirect to websites.
It's not hard to even find something like
<a href="#" onclick="location.href='https://example.com';">click here</a>
The worst part is that it's not just random websites doing this, this can be found on most FAANG websites as well.
Maybe something like this would be a better idea if you absolutely must avoid classes:
https://jsfiddle.net/qa2cdj4v/