This code changes the color of the first word found in that class. Works fine! But how can I change it so if there is only 1 word then don´t change that color?
Code:
$(function() {
$(".widget-title").html(function(i, text) {
return text.replace(/[a-zàâîïôèéêëèùûü]+/i, function(match) {
return '<span class="red">' + match + '</span>';
});
});
});
Thanks =)
1 Answer