我有一組收音機框,您可以選擇您的金額。最後一個選項是其他。我希望該選項在檢查後顯示金額字段。這是使用jquery mobile構建的。選定的單選按鈕顯示與jQuery文本輸入
<fieldset data-role="controlgroup">
<legend>Select Amount</legend>
<input type="radio" name="amount" id="50" value="50" checked="checked"/>
<label for="50">$50</label>
<input type="radio" name="amount" id="100" value="100"/>
<label for="100">$100</label>
<input type="radio" name="amount" id="250" value="250"/>
<label for="250">$250</label>
<input type="radio" name="amount" id="500" value="500"/>
<label for="500">$500</label>
<input type="radio" name="amount" id="1000" value="1000"/>
<label for="1000">$1000</label>
<input type="radio" name="amount" id="other" value="other"/>
<label for="other">Other</label>
<div id="enter_amount">
<label for="other_amount">Enter Amount:</label>
<input type="text" name="other_amount" id="other_amount" value="" data-theme="d" />
</div>
</fieldset>
我需要做什麼來寫這個工作?我目前正試圖以下幾點:
$(document).ready(function(){
$("#enter_amount").css("display","none");
$("#other").click(function(){
if ($('#other:checked')) {
$("#enter_amount").slideDown("slow"); //Slide Down Effect
} else {
$("#enter_amount").slideUp("slow"); //Slide Up Effect
}
});
});
不幸的是,這是不工作的根本躲在負載輸入框外。
工作,謝謝。 – rmlumley