I am working with JSF
and Primefaces 5.2
ad i noticed that when you use a commandLink
and add the event onclick
with p:ajax like that you make a sort of selection on it
<h:commandLink id="commandLink">
<p:ajax event="click"/>
</h:commandLink>
my question is : i am working with javascript and what i want to do is when the user right click on the commandLink
it activate the p:ajax
specification (making the selection effect)
myJavascript
document.oncontextmenu = function () { };
I know that my question is a little bit weird thank you.
You can bind the contextmenu
event to your commandLink
element like so.
var commandLink = document.getElementById('commandLink');
commandLink.addEventListener('contextmenu', function (event) {
alert('commandLink was right clicked');
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.