[英]How to show elements on selected radio buttons?
<input id="auto" type="radio" name="warning_type" value="auto"> <label for="auto">Auto-varning</label> <br>
<input id="manual" type="radio" name="warning_type" value="custom"> <label for="custom">Custom</label> <br>
是我所擁有的。
選擇“手動”時如何顯示#warning_custom,選擇“自動”時如何顯示#warning_auto?
而且,如果您選擇#warning_custom(manual),則#warning_auto應該隱藏,並且應該以相反的方式發生。
我怎樣才能做到這一點? 我試過了,但我設法做到了,一個只顯示,另一個又隱藏了。
我在猜測其余的代碼是什么樣的:
$("input:radio").click(function() {
if ($(this).val()=="auto") {
$("#warning_custom").hide();
$("#warning_auto").show();
} else {
$("#warning_auto").hide();
$("#warning_custom").show();
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.