Reputation: 1574
firstly here the fiddle
I want to add a <span class="Text"></span>
to text ''RSS' inside an <li>
.
HTML Code:
<ul>
<li class="hasToolTip"> RSS Feeds</li>
</ul>
Upvotes: 2
Views: 803
Reputation: 82241
You can find the li that contains text RSS. and then use .html()
call back function to replace the each occurrence of RSS with span wrapped around it:
$("li.hasToolTip:contains('RSS')").html(function(_, html) {
return html.replace(/(RSS)/g, '<span class="Text">RSS</span>');
});
Upvotes: 3