Alternate: jQuery Find Text and Replace with Custom Text

HTML
<div>lorem ipsum dolor sit * amet.</div> outside the scope * ignore ... <span>lorem * ipsum * dolor sit amet not a div * ignore.</span> <div>* lorem * ipsum dolor sit * amet</div>
CSS
JAVASCRIPT
$(document).ready(function() { $('div:contains(*)').html(function() { return this.innerHTML.replace(/\*/g, '<mark>*</mark>'); }); });
Expand for more options Login