I've built a WYSIWYG dhtml editor. Inserting links, images and all that stuff is pretty string forward using execCommand().

I'm looking for a way where as when a user clicks on a a © button my script will insert a character, such as a copyright symbol, at the current insertion point of an innerHTML object.

For instance the innerHTML is initally set to :

foo.innerHTML = 'Wrangler jeans are the best';

When a user places their cursor after the word Wrangler, then presses the © button, the script would change innerHTML to :

'Wrangler© jeans are the best';

Any ideas? I've been looking for a solution for hours.

Thought: I'm sure there is a javascript function to insert text into a string (innerHTML) at a certain location, however, how do I retrieve the current location of the insertion point?

Help is greatly appreciated!