我有一个 change() 事件,它在 IE 11 中没有触发,但在 Chrome 和 Edge 上运行良好。任何帮助将不胜感激


<script>
// If the CountyId changes because the user selected a County from the DropDownList.
$(function () {

$("#RCE_CountyId").change(function () {
alert("It works !");
var countyId = $(this).val();
$("#RCE_RouteId").empty();
$("#RCE_RouteId").append("<option value=''>Select Route</option>");
//var d1 = '?handler=RouteList&CountyId=' + countyId;
//alert(d1);
$.getJSON('?handler=RouteList&CountyId=' + countyId, (data) => {
$.each(data, function (i, item) {
console.log("success");
$("#RCE_RouteId").append('<option value=' + item.routeId + '>' + item.routeName + '</option>');
});
});
});
});
</script>

您正在使用IE不支持的箭头功能。请将箭头函数替换为以下代码:

$.getJSON('?handler=RouteList&CountyId=' + countyId, function (data) {
...
});

最新更新