I have a div with id content . I want to find My Company div in this, and then add after the My Company brand symbol ® anywhere where it appears in the div id = content . The problem is that My Company text is not always in HTML as My Company . It can be My <span style="something">C</span>ompany or My <font color="something">C</font>ompany , and I don’t know how to add the symbol ® after the text My Company , even if it contains html tags (as above).
I want to do this using JS / JQuery. Thank you very much.
I tried:
$("#content").each(function() { var text = $(this).text(); text = text.replace("My Company", "My Company®"); $(this).text(text); });
but it only works if it is My Company NOT when it is My <span style="something">C</span>ompany or My <font color="something">C</font>ompany
EDIT
I have one (one) div #content
Example
<div id="content"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi et nisl quam. Praesent semper enim elit, vel imperdiet ipsum vulputate ac. Curabitur lacinia vitae metus sit amet consectetur. My Company Sed metus risus, iaculis a erat id, pretium congue nisi. Phasellus tempor, massa lobortis scelerisque pharetra, orci metus ultrices quam, eu sodales massa erat ut ipsum. Vestibulum ullamcorper interdum pretium. My <span style="color: orange;">C</span>ompany Praesent mollis in ex in feugiat. Ut vitae placerat diam. </div>
source share