JSFiddle - React, Tailwind, and code Playground
HTML
<p>Hi I'm some text for this paragraph with a service mark. <sup><abbr title="service mark">SM</abbr></sup></p>http://jsfiddle.net/helmutgranda/vPg7g/
<p>This time there <sup><abbr title="service mark">SM</abbr></sup> is different text.</p>
<img src="http://www.google.com/intl/en_com/images/srpr/logo3w.png" alt="Not always text"/> <sup><abbr title="service mark">SM</abbr></sup>
JavaScript
$('abbr:contains("SM")').html('℠').parent().addClass('superscript3');
var sm = $('.superscript3');
sm.each(function(i)
{
this.replace(' <sup class="superscript3">', '<sup class="superscript3">');
});