I hve the following HTML string:
<span class="class1">Hello</span> my <span class="class1">name</span> is Mads.
Is it possible to detect the words ‘my’, ‘is’ and ‘Mads’ and wrap those words in a string who is not already part of a span tag?
So it becomes
<span class="class1">Hello</span> <span class="class1">my</span> <span class="class1">name</span> <span class="class1">is</span> <span class="class1">Mads.</span>
Thanks in advance.
Right,
I have cracked it – although it may not be the prettiest code you guys have seen.
The html spans are updated on -blur event (when you click outside the div editable field).
a link to jsfiddle example!