使用JQuery绑定到MVC中的单击事件 [英] Using JQuery to bind to click events in MVC
本文介绍了使用JQuery绑定到MVC中的单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码弹出窗口,但我收到以下错误。
未捕获的TypeError:对象[object Object]没有方法'对话'
请帮我看一下相同。
I use the following code to pop up window but i am getting following error.
Uncaught TypeError: Object [object Object] has no method 'dialog'
Please help me regarding the same.
$(document).ready(function () {
alert("hi");
debugger;
$(".openDialog").on("click", function (e) {
alert("BBH");
e.preventDefault();
$("<div></div>").addClass("dialog").attr("id", $(this).attr("data-dialog-id")).appendTo("body").dialog({
title: $(this).attr("data-dialog-title"),
close: function () { $(this).remove(); },
modal: true,
width: 600,
left: 0,
})
.load(this.href);
});
$(".close").on("click", function (e) {
e.preventDefault();
$(this).closest(".dialog").dialog("close");
});
})
查看:
View:
@Html.ActionLink("Register here", "RegisterUser", "login", null, new { @class = "openDialog", data_dialog_id = "aboutdialog", data_dialog_title = "register new user" })
推荐答案
( document )。ready( function (){
alert( hi);
d ebugger ;
(document).ready(function () { alert("hi"); debugger;
( .openDialog ).on( 点击, function (e){
alert( BBH);
e.preventDefault();
(".openDialog").on("click", function (e) { alert("BBH"); e.preventDefault();
( < div> ;< / div>)。addClass( dialog)。attr( id,
("<div></div>").addClass("dialog").attr("id",
这篇关于使用JQuery绑定到MVC中的单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文