1

在下面的示例中,如何使用 event 和 ui 对象来检测哪个链接打开了对话框?似乎无法获得 $(event.target).attr("title"); 正常工作,我无法找到有关传递的 'ui 对象的文档。谢谢!

$("#dialog_support_option_form").dialog({
   link_title = $(event.target).attr("title");
   alert(link_title);
});


$("a").live("click", function() {
    btn_rel = $(this).attr("rel");
    $(btn_rel).dialog("open");
});

<a class="btn pencil" rel="#dialog_support_option_form" title="Edit Support Option">Edit</button>
4

2 回答 2

1

您需要在click打开它的情况下进行检测,然后您可以使用它并在对话框中设置一些内容,提醒它......无论您要对值做什么,如下所示:

$("a").live("click", function() {
  var btn_rel = $(this).attr("rel");
  $(btn_rel).dialog("open");
  var title = $(this).attr("title");
  //alert(title);
  //or:
  //$("#dialog_support_option_form .something").text(title);
  //whatever you want to do with it :)
});
于 2010-04-11T12:46:43.733 回答
0

parents() 返回多条记录使用 parent() 代替。

于 2010-04-08T16:20:31.727 回答