JSFiddle - React, Tailwind, and code Playground
HTML
<input type="radio" id="testa" name="existing" value="no" id="existing-no" onclick="existingPartner('no');"> Existing Yes?
<input type="radio" id="test" name="existingpartner" value="no" id="existing-no" onclick="existingPartner('no');"> Existing No
<br><br>
<input type="checkbox" name="mycheckbox" id="mycheckbox" />
<br><br>
<input type="button" id="test-with-prop" value="Test with prop" />
JavaScript
$(document).ready(function(){
var check;
if($("input:radio[name=existingpartner]").is(":checked")){
// Example 3 - With jQuery prop
$("#test-with-prop").on("click", function(){
check = $("#mycheckbox").prop("checked");
if(check) {
alert("Checkbox is checked.");
} else {
alert("Checkbox is unchecked.");
}
});
}
});