JSFiddle - React, Tailwind, and code Playground

HTML

<div class="priority">
    <input type="radio" name="1" id="1">
    <input type="radio" name="1" id="2">
    <input type="radio" name="1" id="3">
    <input type="radio" name="1" id="4">
    <input type="radio" name="1" id="5">
</div>

CSS

.color1 {
    background:red;
}
.color2 {
    background:green;
}
.color3 {
    background:yellow;
}

JavaScript

$(function () {
    $(".priority input").on("click", function () {
        $(".priority").attr("class", "priority color" + this.id);
    });
})