0

MVC の 2 つの DropdownList 要素に jQuery を使用します。しかし、どちらのクラスも「chzn-select」という同じ名前です。値を追加しようとすると、競合が発生します。

「chzn-select」要素を区別する方法を教えてもらえますか?

<tr>
    <td>@Html.Label("branch")
    </td>
    <td>
        @Html.DropDownListFor(m => m.RegionId, (SelectList)ViewBag.Regions, new {@class="chzn-select" ,multiple ="true",data_placeholder = "choose branch", style = "Width:200px", onChange = "regionDropDownChanged();" , tabindex = 3   })
        @Html.ValidationMessageFor(m => m.RegionId)
    </td>
</tr>
<tr>
    <td>@Html.Label("organization")
    </td>
    <td>
        @Html.DropDownListFor(m => m.EnterpriseId, (SelectList)ViewBag.Enterprises, new {@class="chzn-select" ,multiple ="true",data_placeholder = "choose organization", style = "Width:200px", tabindex = 3 })
        @Html.ValidationMessageFor(m => m.EnterpriseId)
    </td>
    <td>
    </td>
</tr>
4

3 に答える 3