Skip to content

Instantly share code, notes, and snippets.

@vladanyes
Created March 15, 2018 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladanyes/116f0461aab8cce7b44febe853d3336d to your computer and use it in GitHub Desktop.
Save vladanyes/116f0461aab8cce7b44febe853d3336d to your computer and use it in GitHub Desktop.
Drupal.behaviors.listWords = {
attach: function () {
$.fn.paintFirstWord= function(color) {
var str = this.text();
var splited = str.split(' ');
var replaced = str.split(splited[0]).join('<span style = "color:' + color + ';font-weight:bold">' + splited[0] + '</span>');
this.html(replaced);
};
$('.pane-fpid-136 li').each( function() {
$(this).paintFirstWord('#e31d34');
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment