jquery dialog - which button opened the dialog?

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-04-08T16:17:55Z Indexed on 2010/04/08 16:23 UTC
Read the original article Hit count: 786

In the example below, how can you use the event and ui objects to detect which link opened the dialog? Can't seem to get $(event.target).attr("title"); to work properly, and I'm having trouble finding documentation on the 'ui object that is passed. Thanks!

$( ".selector" ).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>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui