google chrome, jquery statement, need help
I'm trying to replace every occurrence of the text "basketball" on any page using a Google Chrome extension with jQuery. So in my content script, I have the code:
$('body').html($('body').htm开发者_运维问答l().replace('basketball', 'test'));
but on most pages, the site just doesn't load or looks very messed up. Any ideas?
I am not to sure about the google chrome extenstion but there are many ways to search and replace text. http://jsfiddle.net/zxpgx/ is an example of this.
$("*").each(function () { if ($(this).children().length == 0) { $(this).text($(this).text().replace('basketball','test')); } });
精彩评论