I've created a dropdown and label and surrounded them within a div, however, when i get the div in the following function, it doesnt hide/unhide the label and dropdown??
function ToggleDiv(DivID)
{
if (document.getElementById(DivID).style.display == "none")
{
document.getElementById(DivID).style.display = "block";
}
else
{
document.getElementById(DivID).style.display = "none";
}
}
i've set the default visibility to hidden in the css, as i want the elements to be hidden and then revealled when a checkbox is clicked. Is this the problem? Is the css always making the elements hidden??
#unis
{
visibility:hidden;
}
<div class='row'>
<label id='Recruitmentlbl' for='Recruitment'>Recruitment?:</label>
<input id='Recruitment' name='Recruitment' class='formcbx' type='checkbox' onclick=ToggleDiv("unis")<br />
</div>
<div class='row'>
<div id = "unis">
<label id='Universitylbl' for='University'>University institution:</label>
<select name="uni">
<option value="uni1">uni1</option>
<option value="uni2">uni2</option>
<option value="uni3">uni3</option>
<option value="uni4">uni4</option>
<option value="uni5">uni5</option>
</select><br />
</div>
</div>
but its not working?