【发布时间】:2013-06-29 07:43:20
【问题描述】:
我将 jQuery 用于 MVC 中的两个 DropdownList 元素。 但是这两个类都被称为“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>
【问题讨论】:
-
去掉 class="chzn-select" 前的“@”符号...看看。
-
我是 MVC,你必须使用 @。不使用会报错。
-
好吧@是代码块的开始,它是表示代码的剃刀语法。
-
但是当我删除@它给我错误
标签: javascript css model-view-controller jquery-chosen