請幫忙! 我有可供選擇的選項。當我選擇該選項時,還有一個額外的輸入字段。請幫助找到錯誤。輸入字段不會到來。在jquery中選擇選項
<div id="wrap">
<fieldset>
<ol class="formset">
<li>
<label for="referral">Does the patient need referral?:</label>
<select type="select_option" id="referral" class="aboveage5">
<option value="">Please Select ...</option>
<option value="zanempilo">Zanempilo follow up</option>
<option value="hospital">Clinic/Hospital referral</option>
</select>
</li>
</ol>
<ol id="parent5" class="formset">
<li>
<label for="iy_referred">Referred to: </label>
<input type="text" id="iy_referred" name="iy_referred" class="iy_referred required"/>
</li>
</ol>
</fieldset>
</div>
JS代碼:
$(document).ready(function(){
$("#parent5").css("display","none");
$(".aboveage5").click(function(){
if ($('select[name=referral]:selected').val() == "hospital") {
$("#parent5").slideDown("fast"); //Slide Down Effect
} else {
$("#parent5").slideUp("fast"); //Slide Up Effect
}
});
});
請解釋更 – Prabahar