2012-03-31 56 views
0

我有一個radiogroup,我從中選擇任何一個。同時,當我點擊組中的任何單選按鈕時,我正在對父組應用邊框。所以當我點擊組中的其他單選按鈕時,它應該應用點擊的邊框,並且需要從所有其他兄弟家長中刪除邊框......有什麼好方法可以做到這一點?jquery radiogroup刪除選定的邊框aparat

這是我的代碼,但不工作:

$('input:radio[name="cci"]').click(function(){ 
    $(this).parent().css({border:'1px solid red'});//in the group, rest of the parent need to remove the border..how? 
    }) 

意義,而這是在選定的位置只有父母需要有邊界

回答

1

加入這一行

$('input:radio[name="cci"]').click(function(){ 
    $('input:radio[name="cci"]').css({border:'none'}); 
    $(this).parent().css({border:'1px solid red'});//in the group, rest of the parent need to remove the border..how? 
    }) 
+1

作品。我在第一行添加了父項。感謝 – 3gwebtrain 2012-03-31 12:53:17

+0

是否有可能爲單一功能的所有羣體做? – 3gwebtrain 2012-03-31 12:53:55