如何获取DropDownListFor的选定项?

时间:2013-02-28 11:03:50

标签: asp.net-mvc dropdownlistfor

如何获取DropDownListFor的选定项?这是我的下拉列表:

    <div class="drop-down-list">
        <%: Html.DropDownListFor(model => model.StageId, ViewBag.StagesList as SelectList,new { id="stageOne"})%>
        <%: Html.ValidationMessageFor(model => model.StageId) %>
    </div>

我尝试了这个但是没有用:

<script>
    var e = $('#stageOne').val();
</script>

1 个答案:

答案 0 :(得分:0)

从这里试试.. Get selected text from a drop-down list (select box) using jQuery

$("#yourdropdownid option:selected").text()
$("#yourdropdownid option:selected").val()