Skip to content Skip to sidebar Skip to footer

Contenteditable="true": Creating A Syntax Highlighted Input Form

I'm currently fiddling around with contenteditable='true' to create a syntax highlighted input box. I'm writing a jquery plugin that converts a tag to a

Solution 1:

There is a perfect API for saving and restoring the cursor position: http://code.google.com/p/rangy/

It's the rangy API. All you have to do is

var savedSel = rangy.saveSelection();

to save the cursor position and then

rangy.restoreSelection(savedSel);

to restore the cursor position. You can read more about this here: http://code.google.com/p/rangy/wiki/SelectionSaveRestoreModule

Post a Comment for "Contenteditable="true": Creating A Syntax Highlighted Input Form"