我正在使用下面的代碼創建一個模式,彈出填充頁面基於該id,然後允許您編輯位置。模態不會打開。有人能告訴我爲什麼?Twitter Bootstrap模式無法打開?
@model IEnumerable<LocApp.Models.Location>
<table class="table table-bordered">
<thread>
<tr>
<th>Name</th>
<th>Active</th>
<th>Actions</th>
</tr>
</thread>
@foreach (var item in Model)
{
<thread>
<tr>
<td>
@Html.DisplayFor(modelItem => item.name)
</td>
<td>
@Html.DisplayFor(modelItem => item.active)
</td>
<td>
<a href="@Url.Action("Edit", "Location", new { id = item.id})" class="edit" data-target="#@item.id">Edit</a> |
@Html.ActionLink("Details", "Details", new { id = item.id }) |
@Html.ActionLink("Delete", "Delete", new { id = item.id })
</td>
</tr>
</thread>
<div class="modal hide fade" id="@item.id" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Edit @item.name</h3>
</div>
<div class="modal-body">
</div>
</div>
}
</table>
<script>
$('a.edit').on('click', function (e) {
e.preventDefault();
var url = $(this).attr('href');
$(".modal-body").html('<iframe width="100%" height="100%" frameborder="0" scrolling="no" allowtransparency="true" src="' + url + '"></iframe>');
});
</script>
有什麼我失蹤了嗎?
嘗試jQueryUI的對話框中的http:// jqueryui.com/dialog/ – Omu
@凱爾,解決方案是否幫助您解決問題? – PSL