I have an HTML5 Canvas. When the user double-clicks in a particular region of that canvas, I want a single-field form to appear at that spot, so that the user can edit some text.
My intended effect is similar to this screenshot from Google Docs. I double-clicked on the shape with the “Hello” text, and the editable text field appeared.
I’ve worked out how to detect the double-click, the mouse location, and the text. But so far I’m using a javascript “prompt(…)” dialog to edit the text, which is not what I want.

I guess I’m looking for something to put in this function to replace prompt:
// let the user edit the text, by showing a popup-field that appears at (x, y)
function editText(x, y, text) {
return prompt('Text:', text);
}
If it is relevant, I’m using jQuery a little.
Apprise didn’t seem to do everything you were asking so I wrote this: http://jsfiddle.net/Qj9QR/12/
CSS
JS uses jQuery see fiddle
Updated with position and updating element values