0

How would I go about developing cross-browser event triggering for mouse buttons (left, middle and right) in plain-vanalla JavaScript?

4
  • 1
    Um, why... you could just use jQuery and not reinvent the wheel? Commented Nov 27, 2009 at 0:11
  • 3
    I am fond of home-made wheels. Commented Nov 27, 2009 at 0:20
  • I don't know what all the fuss is about! You all shouldn't be so partial. Shocking! Commented Nov 27, 2009 at 1:15
  • Keep in mind, though you can trigger events, it only causes event handlers to be fired. For instance, triggering a click event on an a link won't open the link. Commented Nov 27, 2009 at 5:11

2 Answers 2

4

A few starting points

Sign up to request clarification or add additional context in comments.

2 Comments

Very nice links. Not sure why this would not have been accepted (compared to the one that was). I just want to point out (to @David as well) that point #6 does not utilize any of points 1-5. @David: you're in for a big surprise when you see the approach jQuery took in simulating events.
Upped you and commented that yours should be accepted as the correct one. More in scope with question.
0

It would be strongly recommended you use a Javascript Library for this purpose.

Most popular being JQuery (recommended)

For additional libraries you can view the following what-is-the-best-lightweight-javascript-framework

Do you have a valid reason for not using any libraries...?

Regards

Gordon

7 Comments

Please, stop asking that sort of questions, and better try answering mine.
Fair enough... in reply to your question, open the jquery source code and copy the "cross-browser event triggering" code and paste it into your javascript file. Its cross browser, its been written and you can pretend its home-made...
could you please show me which part of jQuery I should use and how to rebuild it so that I get exactly what I need. Thanks.
Ridiculous? What's so ridiculous? I asked gg not to demand a valid reason from me because that doesn't pertain to my question.
Sorry. Forget about it. Wrote this after I took the time to gather a few relevant links and saw that you accepted the "hey just copy jQuery's solution" answer. Which upset me a little after you wrote: I want to do it myself. btw. just copying the code and pretending it is home made would be a license violation too
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.