A small introduction to what happens before the question:
When you enter text in contenteditable that contains html tags, it continues to paste into the tag if you are to the right of the tag. For example, if I have a text like this:
The <b>quick</b> fox jumped over the lazy dog.
and it looks like this
fast | the fox jumped over the lazy dog.
My cursor is in the pipe position, right after the word quickly. If I go brown I get
The <b>quick brown</b> fox jumped over the lazy dog.
quick brown | the fox jumped over the lazy dog.
example: http://jsfiddle.net/mBzvs/
My question is: how to remove this tag continuation function for other tags like span? I would like to save it for the <b> , but I do not want this to happen for the <span> .
javascript html html5 contenteditable
Drahcir
source share