我正在为 MVC 4 使用 jqueryuihelpers (http://jqueryuihelpers.apphb.com/Docmo/Dialog)。以下代码来自文档页面。
<p>@Html.JQueryUI().Button("Click me!", new { id = "triggerButton" })</p>
@using (Html.JQueryUI().Begin(new Dialog().AutoOpen(false)
.TriggerClick("#triggerButton")))
{
<p>This dialog is opened with a button.</p>
<p>Please click the X at the top right corner to close it.</p>
}
在上面的示例中,TriggerClick 的选择器仅用于一个按钮,并且可以正常工作。
如果我有超过 1 个按钮,我想使用类选择器“.button”。
@using (Html.JQueryUI().Begin(new Dialog().AutoOpen(false)
.TriggerClick(".button")))
{
<p>This dialog is opened with a button.</p>
<p>Please click the X at the top right corner to close it.</p>
}
在这种情况下,我如何确定哪个按钮触发了单击事件,从而打开了对话框?