I made this function to "split" my elements and give them background-colors:
var colors = ['red','yellow','green','blue'];
function splitColors($item) {
$item.each(function(i) {
$(this).addClass(colors[i % 4]);
});
}
splitColors($('.comment:before'));
now I want to apply this function on a before element in my DOM, but it doesn't work.
Can I access the ::before element in jQuery?
I can't use a real element, cause the WordPress comment section don't allow own markup..
Thanks!