How can I select every word in a page, reverse it and give it another color?
What I tried for now:
jQuery('*').each(function(){
var text = jQuery(this).text().split(' '),
len = text.length,
result = [];
for( var i = 0; i < len; i++ ) {
result[i] = '<span style="color: green;">' + text[i].split("").reverse().join("") + '</span>';
}
jQuery(this).html(result.join(' '));
});
But I am pretty far from what I need. Any clues?