I want to change the colour of the span background in the following HTML depending on the text it contains:
<div class="kn-detail-body">
<span>
<span class="">AAA</span>
</span>
</div>
Unfortunately I can't change the HTML, it's generated from Knack, so I can't add a class to the span. But I want to use JQuery to change the background colour to one of a few choices based on what the span contains. So if it contains 'AAA', it will be green, 'Exec' and it will be blue, 'Media' and it will be yellow, etc. Is this possible?
Cheers to anyone who can help! I found some code to do this but it depends on the span itself having a class applied, which mine don't. Any ideas?
Thanks heaps in advance!