How can I make a Jeditable (jQuery) span activate editing on more than one event?
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",
开发者_JS百科 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.
I'm taking the lack of answers so far to mean that it's impossible, or rather it would require changes to Jeditable or jQuery that would include headaches for the developer, possible code smells, etc.
精彩评论