I know you can get this working with an event listener, but is it possible to catch middle clicks with the onclick attribute in HTML?
For example:
<span onclick="alert('hi');">middle click me<span>
I know you can get this working with an event listener, but is it possible to catch middle clicks with the onclick attribute in HTML?
For example:
<span onclick="alert('hi');">middle click me<span>
A middle click is still giving off a click to your system, so yes it does work. Depending on your system this can do weird things such as opening a new window. Not sure how this affects on-clicks. But they will work.
If you put this around your span instead of using the onClick you can also use middle clicks (in all browsers),but its called bad practice .
<a href="javascript:alert('hi');">
<span>middle click me</span>
</a>