How to target specific letter/word with jquery?

Posted by Gal on Stack Overflow See other posts from Stack Overflow or by Gal
Published on 2010-03-27T17:34:47Z Indexed on 2010/03/27 17:43 UTC
Read the original article Hit count: 392

Filed under:
|
|
|
|

As a mere example, I want to apply the class "fancy" to all occurrences of the sign "&" in the document.

The CSS:

.fancy { font-style: italic; }

So a text that looks like this:

Ben & Jerry's

would be manipulated by jquery to this:

Ben <span class="fancy">&</span> Jerry's

Is there a function to target specific words/phrases/letters like this?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about letter