How do I get which radio radio is selected?

< input name= "dt" type= "radio" id= "first" / >
< input name= "dt" type= "radio" id= "second" / >

check first,jq to get both input returns are on,. How do I know if I check first, I get first

Mar.28,2021

<script src="jquery-1.12.4.js"></script>
<input name="dt" type="radio" id="first"/>
<input name="dt" type="radio" id="second"/>
<div onclick="i1()">1</div>
<div onclick="i2()">2</div>
<div onclick="who()"></div>
<script>
const jqDom1 = $("-sharpfirst");
const jqDom2 = $("-sharpsecond");
function i1(){
    alert(jqDom1.prop("checked"));
}
function i2(){
    alert(jqDom2.prop("checked"));
}
function who(){
    alert($("input[name='dt']:checked").attr("id"));
}
</script>

clipboard.png


  reference link  

Menu