3 ms·
Just a few small changes fixes it: jQuery('div.entry').find(":contains('apple')").each(function() { var html = jQuery(this).html().replace(/apple/gi,"<sp
by byoung2 16y ago
Just a few small changes fixes it:
jQuery('div.entry').find(":contains('apple')").each(function() {
var html = jQuery(this).html().replace(/apple/gi,"<span class='apple'>Apple</span>");
jQuery(this).html(html);
});
I made the str.replace global and case-insensitive (/apple/gi), and changed $.children() to $.find() since on TC the content wasn't the direct descendant of a div. $.find() goes more than one level down. They also seem to be using jQuery.noConflict() so I changed the $ to jQuery.
example: http://fillerspace.com/techcrunch.html http://fillerspace.com/techcrunch.html