C# 使用“帮助”仅打开一个元素;“对话”;MVC环境下JQuery(UI)中的函数
大家好,如果我遗漏了任何细节,请提前原谅我,因为这是我在这里的第一篇帖子: 我在使用dialog JQuery命令时遇到问题。更具体地说,我希望名为“编辑”的按钮(下面第7行)只打开一个窗口,而不是彼此后面的所有窗口。下面是我现在使用的一些代码,以及对codde的简短描述。提前感谢您的阅读C# 使用“帮助”仅打开一个元素;“对话”;MVC环境下JQuery(UI)中的函数,c#,jquery,model-view-controller,jquery-ui,C#,Jquery,Model View Controller,Jquery Ui,大家好,如果我遗漏了任何细节,请提前原谅我,因为这是我在这里的第一篇帖子: 我在使用dialog JQuery命令时遇到问题。更具体地说,我希望名为“编辑”的按钮(下面第7行)只打开一个窗口,而不是彼此后面的所有窗口。下面是我现在使用的一些代码,以及对codde的简短描述。提前感谢您的阅读 <!-- C# and HTML code here--> <table> <tbody> <% foreach (var item in Mode
<!-- C# and HTML code here-->
<table>
<tbody>
<% foreach (var item in Model) { %>
<tr>
<td>
<button class="opener">Edit</button>
<div class="dialogButton" title="Something"><% Html.RenderAction("Something", "Admin", new { id = item.ID }); %></div>
<td>Other values</td>
</tr>
</table>
<!-- JQ script is here-->
$(".dialogButton").dialog({ autoOpen: false });
$(".dialogButton").dialog({ buttons: { "Ok": function () { $(this).dialog("close"); } } });
$(".dialogButton").dialog({ show: 'fade' });
$('.opener').click(function () { $('.dialogButton').dialog('open'); });
理论上,假设这只打开一个元素,但事实并非如此。请帮忙
再次感谢你 只需为每个div class=“dialogButton”和button class=“opener”放置唯一的ID 像div class=“dialogButton”id=“dialogButton\u 1”和 button class=“opener”id=“opener\u 1.使用item.id或其他唯一的东西 然后用ID调用对话框插件 $('.opener')。单击(函数(){$('.#dialogButton.'+$(this.attr('id')).dialog('open');}) 基本上,您将以这种方式调用与开场白共同响应的对话框 希望这听起来合乎逻辑
$('.opener').click(function () { $(this).next().dialog('open'); });