I need to inject some html into a text while preserving the original html. It doesn't matter if it's in javascript or php.
As an example. Base Test:
Die geistes– und sozialwissenschaftliche
Auseinandersetzung mit <em>Human Enhancement</em> hat erneut zu
Debatten über den Status des Menschen als Cyborg geführt.
Then I got the same thing as html-stripped string. Search String:
Die geistes– und sozialwissenschaftliche
Auseinandersetzung mit Human Enhancement hat erneut zu
Debatten über den Status des Menschen als Cyborg geführt.
I can search by the second string, but need to inject some html behind the first one. Result:
Die geistes– und sozialwissenschaftliche
Auseinandersetzung mit <em>Human Enhancement</em> hat erneut zu
Debatten über den Status des Menschen als Cyborg geführt.<span>1</span>
It's not that easy ... :) I can find and replace the string via Regex and jQuery's .text() function. But that doesn't preserve the original html.
in example. I need the to be exactly behind the found text, not the html element.
– thgie Aug 25 '15 at 09:46