I am wanting to show a hidden field but only when an option is selected in the dropdown. It does not matter which option is selected but I need one to be selected.
Javascript:
<script type="text/javascript">
function Select(sel,id,nu){
document.getElementById(id).style.display=sel.selectedIndex==nu?'block':'none';
}
</script>
Selection:
<select name="options[1]" id="select_1"
class=" required-entry product-custom-option"
title="" onchange="opConfig.reloadPrice();displayCondition();Select(this,divShow,1)">
<option value="" >-- Please Select --</option>
<option value="1" price="0" >Perfect </option>
<option value="2" price="-35" >Excellent </option>
<option value="3" price="-105" >Good </option>
<option value="4" price="-140" >Poor </option>
<option value="5" price="-252" >Broken </option>
</select>
The above onchange will only work if the first item is selected, so I am unsure how to make it work for any item selected. Also, I know the divShow should have some ' around it but I don't know how to write it into the following php:
$extraParams .= ' onchange="opConfig.reloadPrice();displayCondition();Select(this,'."divShow".',1)"';
Div Box:
<div id="divShow" style="display:none;">
<?php echo $this->getPriceHtml($_product) ?></div>