JSFiddle - React, Tailwind, and code Playground
by Riskbreaker
HTML
<body>
<div class="content">
<p>arbesthealth</p>
</div>
</body>
CSS
body {font-size: 1.5em;}
span { font-weight: bold;}
JavaScript
$.fn.wrapInTag = function(opts) {
var o = $.extend({
words: [],
tag: '<strong>'
}, opts);
return this.each(function() {
var html = $(this).html();
for (var i = 0, len = o.words.length; i < len; i++) {
var re = new RegExp(o.words[i], "gi");
html = html.replace(re, o.tag + '$&' + o.tag.replace('<', '</'));
}
$(this).html(html);
});
};
$('.content').wrapInTag({
words: ['best'],
tag: '<span>'
});