JSFiddle - React, Tailwind, and code Playground

HTML

<img src="#" id="test" />

<input type="radio" id="test" value="male" />

JavaScript

$("img").click(function(){
    var imgID = $(this).attr("id");
    $("input:radio[id='"+imgID+"']").attr("checked", "checked");
});