我有一组收音机框,您可以选择您的金额。最后一个选项是其他。我希望该选项在检查后显示金额字段。这是使用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