JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div class="dv1">
<span correct="sp1"> D </span>
<span correct="sp2"> C </span>
<span correct="sp3"> Z </span>
</div>
CSS
.active{
background: red;
}
JavaScript
$(".dv1").find('span[correct=sp2]').addClass("active");