Quiero activar el evento de clic derecho del mouse a través de JS.
Aquí está mi código de prueba:
var obj = document.getElementById("testItem"); var evObj = document.createEvent("MouseEvents",); evObj.initEvent('click', true, false); Object.defineProperty(evObj, "button", { value: 2, writable: false }); Object.defineProperty(evObj, "buttons", { value: 2, writable: false }); obj.dispatchEvent(evObj);Probé muchos métodos, pero no funcionaron.
Alguien sabe como solucionarlo?
Gracias de antemano.