Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AddEventListener: onmousedown [closed]

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() {

});
like image 292
Ryan Hawdon Avatar asked Feb 14 '15 08:02

Ryan Hawdon


People also ask

What does Onmousedown mean?

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.

How do I use 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.

What is the difference between Mousedown and click?

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.

How do I remove event listeners?

Event listeners can also be removed by passing an AbortSignal to an addEventListener() and then later calling abort() on the controller owning the signal.


1 Answers

It is mousedown not onmousedown.

object.addEventListener("mousedown", myScript);

ref: http://www.w3schools.com/jsref/event_onmousedown.asp

like image 148
Lorenzo Cinque Avatar answered Oct 05 '22 01:10

Lorenzo Cinque