I am trying to add TradeMark sign TM next to the company name in the HTML.
Using below text:
<sup>TM</sup>
OR
™
I have a rendered HTML, in which I have to add the trademark sign.
HTML:
Note: I have mentioned a small part of HTML body
<div class="col-md-3">
<div class="logo"><img src="/wp-content/uploads/2017/02/logo.png"
onClick="window.location='https://www.walmart.com'"
alt="Walmart Inc" title="This is Walmart Inc for your help" style="pointer-events:all" />
</div></div>
<div class="submenu">
<a href="/blog" target="_blank">Walmart Inc Blog</a>
<a href="/blog" target="_blank">New Walmart Inc Products</a>
</div>
<meta itemprop="brand" content=" Walmart Inc"><p>Welcome to Walmart Inc.</p>
Tried below options:
$("body").children().each(function () {
$(this).html($(this).html().replace(/Walmart Inc/g, "Walmart Inc™"));
});
above option replaces "HTML tag properties' values" i.e. alt, title of img as well, which I don't want.
$("body").children().each(function () {
$(this).html($(this).text().replace(/Walmart Inc/g, "Walmart Inc™"));
});
& this results in removing all the HTML tags from the body.
How to exclude text inside the properties of Tags while replacing?
Desired Output:
<div class="col-md-3">
<div class="logo"><img src="/wp-content/uploads/2017/02/logo.png"
onClick="window.location='https://www.walmart.com'"
alt="Walmart Inc" title="This is Walmart Inc for your help" style="pointer-events:all" />
</div></div>
<div class="submenu">
<a href="/blog" target="_blank">Walmart Inc™ Blog</a>
<a href="/blog" target="_blank">New Walmart Inc™ Products</a>
</div>
<meta itemprop="brand" content=" Walmart Inc"><p>Welcome to Walmart Inc™.</p>