【发布时间】:2013-01-17 21:49:30
【问题描述】:
我试图有一个图标,当单击时,触发一个 jQuery 对话框,显示特定于被单击项目的消息。由于我是 jQuery 新手,我绝对没有运气。有人可以告诉我我做错了什么吗?
ASP MVC 视图中的代码部分
<td>
@if (!String.IsNullOrWhiteSpace(item.Notes))
{
<span id="notes" onclick='GetNotes(@id);'>
<img src="@Url.Content("~/Content/images/magnify.gif")" alt="Show Notes" />
</span>
}
<div id="@id" style="display:none;">
@Html.DisplayFor(modelItem => item.Notes)
</div>
</td>
jQuery 代码:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script src="@Url.Content("~/Scripts/jquery.tablesorter.min.js")" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#thetable").tablesorter();
}
);
function GetNotes(id) {
$(function GetNotes() {
$("#" + id + "\"").dialog();
});
}
</script>
编辑
onlick 方法名称之前包含错误。有一个额外的')'。
【问题讨论】:
标签: jquery asp.net-mvc dialog