I have the code below that gives a style to the last word inside an element with a particular class and works fine.
This class is inside a grid of articles and when I click a filter that loads (without page reload) different articles, the new articles have not that style.
jQuery(document).ready(function($){
$('.products h2.entry-title').html(function(index, curHTML) {
var text = curHTML.split(/[\s-]/),
newtext = '<span style="color:#fbb316;">' + text.pop() + '</span>';
return text.join(' ').concat(' ' + newtext);
});
});
Any help to fix this? Thank you.