【发布时间】:2013-06-14 10:09:57
【问题描述】:
我正在尝试在 mvc 3 应用程序的列表操作中显示有关删除链接的模式确认对话框。
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#dialog-confirm").dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 180
});
});
$(document).delegate(".deleteLink", "click", function (e) {
e.preventDefault();
alert('test');
var $link = $(this);
var $dialog = $('#dialog-confirm')
.dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 180,
buttons: {
'button text': function () {
alert("button"); //this is the button, do something with it :)
}
}
});
$dialog.dialog('open');
});
<div id="dialog-confirm" title="Delete the item?" >
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>This item will be deleted. Are you sure?</p>
这是链接
@Html.ActionLink("حذف", "Delete", "Need", new { id = item.NeedID }, new { @class = "deleteLink", title = "حذف" })
当我删除按钮选项时它可以工作,但当我添加它时,它不再显示 我哪里做错了?
【问题讨论】:
-
起初我使用 .live 选项,但它是一样的
-
嗨,我也在努力。这对你有用吗?请问我需要一些帮助。
标签: asp.net-mvc-3 jquery-ui modal-dialog confirmation