JSFiddle - React, Tailwind, and code Playground

by Saranya Sadhasivam

HTML

<div id="recovery">
    <form>
        <input type="radio" name="s" checked="checked" value="1" />
        <input type="radio" name="s" value="2" />
        <input type="radio" name="s" value="3" />
    </form>
</div>

JavaScript

$('#recovery input[type=radio]').each(function(){
    if($(this).attr('checked')){
        console.log($(this).val());
        alert ($(this).val());
    }
});