How can I make a Jeditable (jQuery) span activate editing on more than one event?
Posted
by
JonathanHayward
on Stack Overflow
See other posts from Stack Overflow
or by JonathanHayward
Published on 2010-07-26T20:46:40Z
Indexed on
2010/12/22
21:54 UTC
Read the original article
Hit count: 236
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.
© Stack Overflow or respective owner