I want a sub form to appear based on what answer I choose in a select input. I can't understand why its not working. No error messages in console, but nothing happens.
document.getElementById('isAthlete').onchange = function(){
if(this.value == 'yes'){
document.getElementById('athleteQ').style.display = '';
} else {
document.getElementById('athleteQ').style.display = 'none';
}
};
<p>If I select 'yes': <br>
<select id='isAthlete' name='isAthlete'>
<option value="-">-</option>
<option value="yes">yes</option>
<option value="no">no</option>
</select>
<p>Then I want to display these inputs: <br>
<div id='athleteQ' style='display: none'>
Sport?<input type='text' id='sport' name='sport'><br>
Medals?<input type='text' id='medals' name='medals'><br>
Comps?<input type='text' id='competitions' name='competitions'><br>
</div>