未捕获的TypeError:$(…)。on不是函数
我在我的页面上使用JQuery UI对话框并收到此错误
Test $(document).ready(function () { $(".hlk1").on("click", function () { var linkId = $(this).attr("linkID"); alert(linkId); // initialize dialog var dlg = $("#dialog").dialog({ autoOpen: false, modal: true, draggable: false, resizable: false, position: ['center', 'top'], height: 380, width: 530, dialogClass: 'ui-dialog-osx', buttons: { "Done": function () { $(this).dialog("close"); } } }); // load content and open dialog dlg.load('page2.html?id=' + linkId).dialog('open'); }); }); Click here
Click here
任何人都可以帮我解决这个问题吗? 它可能是JQuery版本,但这是通过NuGet包管理器安装的Visual Studio版本
.on()
是在jQuery 1.7中引入的,但看起来你运行的是1.6.4。 如果您无法更改版本,则应该能够将function更改为.click
$(".hlk1").click(function () { ...