views:

29

answers:

0

For the jQuery extension Jeditable, one of the parameters that can be specified is which DOM event will turn a div/span/... into a text input/textarea/...

I would like to have more than one event serve as a trigger; that is, I would like either a click event or a contextmenu event to turn a span into an in-place edit area.

Is there a graceful way to do this without forking Jeditable?

--edit--

An example of code specifying the event is below. The parameter is optional, defaulting to a regular click.

    $(".edit_rightclick").editable("/ajax/save",
        {
        cancel: "Cancel",
        submit: "OK",
        tooltip: "Right click to edit.",
        event: "contextmenu",
        });

Calling twice, once for the regular click event with the event unspecified, and one for the contextmenu event (right-click if there are no switched mouse buttons or anything like that) does not seem to produce the intended effect of an element becoming editable in place on a click from either mouse button.