Got a form with a div dropdown which when select will display/hide another div.
<div>
<select id="currency" name="currency" onChange="display_payroll_div(this.selectedIndex);">
<option value="0">Currency for your quote*</option>
<option value="AUD">AUD</option>
<option value="USD">USD</option>
<option value="Pounds">GBP</option>
</select>
</div>
<div id="payroll-div">
<select id="report-payroll" name="report-payroll">
<option value="0">Would you like us to do payroll?*</option>
<option value="1">Yes, I would like payroll</option>
<option value="2">No, I don't need payroll</option>
</select>
</div>
Javascript:
function display_payroll_div(e){
currency_value=document.getElementById('currency').value;
document.getElementById('payroll-div').style.display = "none";
if (currency_value == 'AUD') {
document.getElementById('payroll-div').style.display = "block";
}
}
The display/hide is fine but the issue I have is when I select 'AUD' and 'Yes, I would like payroll' and then change my mind and change to 'USD' the hidden field payroll will still keep the value of 'Yes,...'. Is there anyway to reset 'payroll-div' to default value?
All suggestions I've seen uses 'onClick' which I'm trying to avoid as it does not work in FF. Any help would be appreciated :)
document.getElementById("report-payroll").selectedIndex=0when hiding?