Jquery can select and right click

I am using jquery as shown below.

//Selectable Functionality
$(document).ready(function () {
    $("#Selectable_Positions").selectable({
        selected: function (event, ui) {
            dostuff();
        }
    })
})

It works correctly, however only a left click will trigger the selection event. I'm trying to make it right click. I tried to add the code below and the warning fires, but the selected item does not change.

$(document).ready(function () {
    $('#Selectable_Positions').mousedown(function () {
        $('#Selectable_Positions').trigger('selectableselected');
        alert('foo');
    })
})

How can I programmatically change the selected item in the mousedown event function?


change

Updated event name as suggested by Ian below.

I created a jsfiddle showing what I'm trying to achieve, and the triggered event does not fire when I right-click. Does anyone know how to make this work? It would be very helpful

http://jsfiddle.net/Jzjdm/

+5
source share
2 answers

. , .

+1

- "selectablesedlected". :

$('#Selectable_Positions').trigger('selectableselected');

:

+2

All Articles