css - Closing span tags in content editable div -


i'm creating content editable div words type turn bold , red (using jquery...etc). i've achieved replacing target words same word enclosed appropriately styled span tags. example:

target ----> <span style="color:red; font-weight:bold">target</span> 

the problem once replace target word it's spanned version, else type in content-editable div placed inside target word's span tags instead of outside them. example:

* want: <span style="color:red; font-weight:bold">target</span> other words * happens: <span style="color:red; font-weight:bold">target other words</span> 

what's elegant way around this? i'm trying avoid adding span houses zero-width character , returns style normal.

#fill_me { font-weight: bold; color: red; }

<span id="fill_me">target</span>

$(' other words').insertafter('#fill_me');


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -