JS image swap for 2 image classes

Hello, I have some code I was hoping to get some help with. I have included a piece of JS in my theme that swaps the image if it has the class 'unearned-badge'. The code works fine, but sometimes the class shows up as class="unearned-badge wp-post-image", and in that case the code doesn't swap the image.

jQuery(function ($) {
	$(".unearned-badge").attr("src", "/wp-content/themes/social-classroom-2-0/images/unearned-blank-badge.png ");

Is there a way to swap the image for any time that the class ".unearned-badge" shows up, or at least a way to include both that and the "unearned-badge wp-post-image" class? Any help is greatly appreciated. :slight_smile:

The site is spanish-academy.ca