Hi there is there a way to make a particular text bold for example
I have this #boldword and I want #boldword2 this two to be bold like this.
I have this word and I want word2 this two to be bold like this.
So as you can see the second example I want every word that has bold in front to become bold and the #bold to be removed.
I tried something so far
$.fn.wrapInTag = function(opts) {
var tag = opts.tag || 'strong',
words = opts.words || [],
regex = RegExp(words.join('|'), 'gi'),
replacement = '<strong>$&</strong>';
return this.html(function() {
return $(this).text().replace(regex, replacement);
});
};
$('p').wrapInTag({
tag: 'em',
words: ['#boldworld']
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>The #boldworld is big and red.</p>