2016-11-25 57 views
0
@Html.DropDownList("city",(SelectListItem)ViewBag.city,new { @class = "form-control", @onchange="fun1()"}) 


$(document).ready(function fun1() { 

     alert("Selected item value is " + $("#city").val() + " and Selected item 
      text is " + $("#city option:selected").text()); 

    }); 

回答

0

将您的功能写入function fun1() outside document.ready。它会工作。

相关问题