Wrapping specific words inside SPAN elements?
Let's say I have this paragraph...
<p>My dog is brown.</p>
I would like to accomplish this...
<p>My <span class="animal">dog</span> is brown.</p>
So, I want to use JavaScript to find all "dog" strings inside the paragraph and wrap them in a SPAN element of a given class....
I would love to have a plug-in that does that... like this:
$("p").findAndWrap("dog", "<span class='animal' />");
I know this can be done in JS, but I'm not particularly experienced in JS string manipulation, so it would take a while until I would accomplish this...
Is there a plug-in that does this?