JSFiddle - React, Tailwind, and code Playground
HTML
<input name="featured_ad" value="1" type="checkbox" onclick="resetradio(this)">condition
<br><br>
<input type="radio" name="ad_pack_id" value="497649" onclick="setcheckbox()">value 1<br>
<input type="radio" name="ad_pack_id" value="497648" onclick="setcheckbox()">value 2<br>
<input type="radio" name="ad_pack_id" value="497647" onclick="setcheckbox()">value 3<br>
JavaScript
function resetradio (checkbox) {
var radios = document.getElementsByName('ad_pack_id');
var index = 0, length = radios.length;
if (checkbox.checked == false) {
for ( ; index < length; index++) {
radios[index].checked = false;
}
}
else {
radios[index].checked = true;
}
}
function setcheckbox () {
var checkbox = document.getElementsByName('featured_ad')[0];
if (checkbox.checked == false) {
checkbox.checked = true;
}
}