我有一个调用 jquery 函数的@Html.DropDownList。但它未能调用该函数。我努力了-
$(document).ready(function () {
$('.test').change(function () {
alert("1");
});
});
@Html.DropDownList("PropertyContent", ViewBag.PropertyList as List<SelectListItem>, new { @class="test"})
和
function test() {
alert("1");
}
@Html.DropDownList("PropertyContent", ViewBag.PropertyList as List<SelectListItem>, new { onchange="test();"})
@Scripts.Render("~/bundles/jqueryval") is also included in the view
这里有什么问题?