How can I manually trigger a right click using Javascript?
I can do this with jQuery but I can only use pure Javascript in this case.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create an event using the
CustomEventconstructor, or (when it is not supported), create an event usingdocument.createEventwith as argument the string “HTMLEvents” (because you’re going to create aclickevent). Then, use theinitEventmethod to create aclickevent.Finally, use the
dispatchEventmethod to fire the event. If you’re using IE, thefireEventmethod has to be used instead.If you want to trigger the rightclick event,
contextmenu, use the code below: