So for example:
I have multiple <span> elements with the class of .listing-text that say Available, some that say Pending, and some that say Sold.
I'd like to assign a green background to the ones that say Available, yellow to Pending, and red to Sold.
I've tried a few different for loops and whatnot. All I've been able to make work so far is just turning every box green, and I assume that's because I'm not iterating properly. The only thing I can seem to get right is
$('.listing-text').css('background-color','green');
It reliably changes all backgrounds to green.
Any help would be appreciated.