如何使用jQuery从下拉列表中选择特定项目时使文本框处于活动和非活动状态?

问题描述:

<td>&nbsp;@Html.LabelFor(model => model.DeductorType)</td>
               <td>
                   @{ List<SelectListItem> li = new List<SelectListItem>();
                    li.Add(new SelectListItem { Text = "Select", Value = "0", Selected = true });
                    li.Add(new SelectListItem { Text = "A-Central Government", Value = "A-Central Government"});
                    li.Add(new SelectListItem { Text = "B-Body Of Individuals", Value = "B-Body Of Individuals" });
                    li.Add(new SelectListItem { Text = "D-Satutary Body(Central Govt.)", Value = "D-Satutary Body(Central Govt.)" });
                    li.Add(new SelectListItem { Text = "E-Satutary Body(State Govt.)", Value = "E-Satutary Body(State Govt.)" });
                    li.Add(new SelectListItem { Text = "F-Firm", Value = "F-Firm" });
                    li.Add(new SelectListItem { Text = "G-Autonomous Body(Central Govt.)", Value = "G-Autonomous Body(Central Govt.)" });
                    li.Add(new SelectListItem { Text = "H-Autonomous Body(State Govt.)", Value = "H-Autonomous Body(State Govt.)" });
                    li.Add(new SelectListItem { Text = "J-Artificial Juridical Person", Value = "J-Artificial Juridical Person" });
                    li.Add(new SelectListItem { Text = "K-Company", Value = "K-Company" });
                    li.Add(new SelectListItem { Text = "L-Local Authority(Central Govt.)", Value = "L-Local Authority(Central Govt.)" });
                    li.Add(new SelectListItem { Text = "M-Branch/Division of Company", Value = "M-Branch/Division of Company" });
                    li.Add(new SelectListItem { Text = "N-Local Authority(State Govt.)", Value = "N-Local Authority(State Govt.)" });
                    li.Add(new SelectListItem { Text = "P-Association of Person(AOP)", Value = "P-Association of Person(AOP)" });
                    li.Add(new SelectListItem { Text = "Q-Individual/HUF", Value = "Q-Individual/HUF" });
                    li.Add(new SelectListItem { Text = "S-State Government", Value = "S-State Government" });
                    li.Add(new SelectListItem { Text = "T-Association of Person(Trust)", Value = "T-Association of Person(Trust)" });
               }
               &nbsp;@Html.DropDownListFor(model => model.DeductorType, li, new { style = "width:160px"})
               @Html.ValidationMessageFor(model => model.DeductorType)
           </td>













这是mvc4下拉列表的代码







this is the code for drop down list in mvc4

使用下拉列表的更改事件进行分析选择值,并根据值enable \禁用您的复选框。



Googlejquery select change event或jquery select change event mvc,和 jquery禁用文本框以两者为例,然后将它们放在一起。
Use the change event of the drop down to analyse the select value, and based on the value enable\disable your checkboxes.

Google "jquery select change event" or "jquery select change event mvc", and "jquery disable textbox" for examples of both, then put them together.