I want to bind a function to a right click. Is this possible with jQuery UI?
though not listed on http://api.jquery.com/bind/, the 'contextmenu' event seems to work
$('.rightclickable').bind('contextmenu', function() {
// right-click!
});
Not directly, but you can check which mouse button was pressed in a normal mousedown
event handler, with the which
property of the event object:
$("#someElem").mousedown(function(e) {
if(e.which == 3) {
//Right click!
}
});
Here's a working example of the above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With