2011-08-31 54 views
0
 <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_auto時,如何顯示#warning_custom?

如果您選擇#warning_custom(手動),那麼應該隱藏#warning_auto,並且應該以相反的方式進行。

我怎樣才能做到這一點?我試過,但我不能設法讓一個只顯示又一次的其他皮..

+0

這是哪裏的手冊,你說到 ?我沒有在代碼中看到它。 –

回答

0

我猜,什麼你的代碼的其餘部分是這樣的:

$("input:radio").click(function() { 
    if ($(this).val()=="auto") { 
     $("#warning_custom").hide(); 
     $("#warning_auto").show(); 
    } else { 
     $("#warning_auto").hide(); 
     $("#warning_custom").show(); 
    } 
}); 
相關問題