I have a span element that I want to become editable upon double-click. (That is, the user can edit the text and it will save when s/he clicks outside.)
The effect I want to emulate is similar to when I double-click CSS properties in the Google Chrome Developer Tools. (See picture.)

Now tested, and does work (at least Firefox 8 and Chromium 14 on Ubuntu 11.04):
JS Fiddle demo.
Edited in response to Randomblue’s comment (below):
Just append the
blur()method:JS Fiddle demo.