Trying to find some text that is content produced by a ":before" pseudo-element.
And then I would like to change the css of that content.
Is this even possible? Here's what I have.
Thanks.
var $test = $('.test').html();
$test = $test.replace(/one/gi, '<span class="red">one</span>');
$test = $test.replace(/two/gi, '<span class="green">two</span>');
$test = $test.replace(/three/gi, '<span class="blue">three</span>');
$('.test').html($test);
.test:before { content: 'one two three';}
.red {color: red;}
.green {color: green;}
.blue {color: blue;}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="test"></div>
Here is a fiddle.