<input type="radio" name="choice" value="yes" id="yes"> <label for="yes">Yes</label>
<input type="radio" name="choice" value="no" id="no"> <label for="no">No</label>
<input type="text" id="extra-info" placeholder="Please specify (if Yes)">
<script>
const extraInfoField = document.getElementById('extra-info');
const yesRadio = document.getElementById('yes');
yesRadio.addEventListener('change', function() {
if (this.checked) {
extraInfoField.required = true;
} else {
extraInfoField.required = false;
}
});
</script>