lundi 26 janvier 2015

Reset a dropdown with a checkbox

Currently, I have a checkbox that when not checked, the dropdown is disabled. What line can I add to reset the dropdown also while unchecked?



<body onload="enable_dropdown(false);">

<form name="f1" method="post" onload="enable_dropdown(false);">
<input type="checkbox" name="others" onclick="enable_dropdown(this.checked)" >Others

<select id="that_select">
<option value="a">A</option>
<option value="b" selected>B</option>
<option value="c">C</option>
</select></form>


My Javascript



function enable_dropdown(status)
{
status=!status;
document.f1.that_select.disabled = status;

}




Aucun commentaire:

Enregistrer un commentaire