Created
March 30, 2012 03:22
-
-
Save jakebresnehan/2246189 to your computer and use it in GitHub Desktop.
Finds text and wrap with element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Finds the text 'pancakes' in .food and wraps it with a span which has the sauce class. YUMMY! | |
$('.food:contains(pancakes)').each(function(){ | |
$(this).html( | |
$(this).html().replace('pancakes','<span class=\'sauce\'>pancakes</span>') | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment