我有这个密码
<div id="aggregate" style="display:inline">
<%=Html.RadioButton("a", "1", true, new {id = "meRadio"})%><label>Me</label>
<%=Html.RadioButton("a", "2", false, new { id = "teamRadio" })%><label>Team: </label><% = Html.DropDownList("Teams", Model.Teams, new {@scope="Team", @id = "teamDropdown", @class = "filterDropdown" })%>
<%=Html.RadioButton("a", "4", false, new { id = "managerRadio" })%><label>Manager: </label><% = Html.DropDownList("Managers", Model.People, new { @scope = "Manager", @id = "managerDropdown", @class = "filterDropdown" })%>
<%=Html.RadioButton("a", "5", false, new { id = "locationRadio" })%><label>Location: </label><% = Html.DropDownList("Locations", Model.Locations, new { @scope = "Location", @id = "locationDropdown", @class = "filterDropdown" })%>
</div>
我现在有这样的代码:
$('#workstreamRadio').click(function () {
Enable("#workstreamDropdown");
});
$('#teamRadio').click(function () {
Enable("#teamDropdown");
});
我确信有一种方法可以使用jquery动态地获得相应的下拉选择器,只要单击一个特定的单选按钮,这样我就不必硬编码每个映射。