I am creating a Chrome Extension which checks to see if there is "onmousedown" attribute and if so I will execute some code.
I have tried this however it isn't working.
document.addEventListener("onmousedown", function() {
});
Definition and Usage The onmousedown event occurs when a user presses a mouse button over an element. Tip: The order of events related to the onmousedown event (for the left/middle mouse button): onmousedown.
OnMouseDown is called when the user has pressed the mouse button while over the Collider. This event is sent to all scripts of the GameObject with Collider. Scripts of the parent or child objects do not receive this event. This function is not called on objects that belong to Ignore Raycast layer.
Note: This differs from the click event in that click is fired after a full click action occurs; that is, the mouse button is pressed and released while the pointer remains inside the same element. mousedown is fired the moment the button is initially pressed.
Event listeners can also be removed by passing an AbortSignal to an addEventListener() and then later calling abort() on the controller owning the signal.
It is mousedown
not onmousedown
.
object.addEventListener("mousedown", myScript);
ref: http://www.w3schools.com/jsref/event_onmousedown.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With