📅  最后修改于: 2022-03-11 15:03:20.827000             🧑  作者: Mango
//must have a condition to select a value and
//then get the element of that value individually to set it to checked.
//-you can take the value in var or get it from an object for ex.
var targetOption='male'
if(targetOption=='female') document.getElementById("female").checked=true;
if(targetOption=='male') document.getElementById("male").checked=true;