2011-09-22 96 views

回答

4

試試這個:

$(document).ready(function(){ 
    $("#yourCheckBoxId").change(function(){ 
     if($(this).attr("disabled").length) 
     { 
      $("#yourDropDownId").removeAttr("disabled"); 
     } 
     else 
     { 
      $("#yourDropDownId").attr("disabled", "disabled"); 
     } 
    }); 
}); 

(未經測試)

+0

您好,我有一個多個查詢我有什麼有在:在select_tag.safe_concat的disabled屬性select_tag「user」, options_from_collection_for_select(testters,「id」,「name」,get_selected_user(cycle_ic_revision_assignment,platform_config)), :id =>「select _#{rev_assign_id} _#{platform_config_id}」, :class =>「 add_ic_run_user「 – ramya

+0

你只需要改變checkboxid和下拉列表。禁用=「禁用」由腳本設置和刪除。你應該不採取任何措施。如果這沒有回答你的問題,我沒有正確理解你:)。 – JNDPNT

+0

嗨,我的問題是這樣的select_tag 「用戶」,options_from_collection_for_select(測試, 「ID」, 「姓名」,get_selected_user(cycle_ic_revision_assignment,platform_config)):ID => 「選擇_#{rev_assign_id} _#{platform_config_id}」 ,:class =>「add_ic_run_user」我是否必須設置:disabled => true或不是 – ramya

0

最近的jQuery的支持.prop法版本。

例如:$(「#dropdownid」)丙(「禁用」,「真」)

相關問題