I am trying to find a specific string on a page, lets say I am trying to find the string "ibf". This string can be in any textelement, headline, etc, so it has no specific class to it. There could also be multiple elements on one page that contain the string.
This is some sample text:
"this is ibf text"
It could look something like this above. Now I want to make only the ibf part bold
"this is <b>ibf</b> text"
What can I try for this? I am happy to use JavaScript or jQuery.
2
Answers
In the general case:
You can simply achieve that using the
String.replaceAll()
method.Live Demo :