這裏是我的對話框jQuery的對話框不會關閉
</script>
<script type="text/javascript">
$.ajaxSetup({ cache: false });
$(document).ready(function() {
$(".openDialog").live("click", function (e) {
e.preventDefault();
$("<div></div>")
.addClass("dialog")
.attr("id", $(this)
.attr("data-dialog-id"))
.appendTo("body")
.dialog({
title: $(this).attr("data-dialog-title"),
minWidth: 200,
minHeight: 100,
resizable: false,
close: function() { $(this).remove() },
modal: true
// buttons:{
// close:function(e){
// e.preventdefault();
// $(this).closest(".dialog").dialog("close");
// }}
})
.load(this.href);
});
$(".close").live("click", function (e) {
e.preventDefault();
$(this).closest(".dialog").dialog("close");
});
$(".refresh").live("click", function (e) {
e.preventDefault();
location.reload();
});
});
</script>
jQuery和這裏是我刪除視圖
@using (Html.BeginForm()) {
<div>
<p>Are you sure you want to delete?</p>
@Html.HiddenFor(model=>model.UId)
<table border=0>
<tr>
<td>Name:</td>
<td>@Html.DisplayFor(model =>model.FName)
@Html.DisplayFor(model => model.LName)</td>
</tr>
<tr>
<td>PAddress:</td>
<td>@Html.DisplayFor(model => model.PAddress)</td>
</tr>
</table>
<input type="submit" value="Yes"/>
<button class="close">No</button>
</div>
}
的問題是,當我從按鈕關閉對話框不會調用close類不close.but當我刪除preventDefault對話框關閉。任何幫助,請爲什麼對話框不關閉。
爲1.7 .live()已過時,建議使用。對(),而不是 – Leon 2012-07-26 05:39:03
我想它也將在刪除教職員和調用它但不工作。還有當我穿上()。 e.preventDefault操作不起作用,即數據被刪除。 – 2012-07-26 06:00:30