I have an html text snippet that is part of the DOM of the page in which I need to run find / replace, and I need help determining the best way to create the find / replace function.
For example, I would like to take the contents of the dom object, id = "content" and run find using the target search phrase.
I need a function to replace each instance of a phrase that it finds in the content with "<b> The Phrase </b>", provided that the phrase does not appear inside any tag other than div, p, span or td and return the replaced xhtml text.
Can I do this with jQuery dom traversal along with some substitution method?
Scott B
source share