how to get the id to open dialog box
jquery, jquery-plugins, jquery-selectors, jquery-ui
Solution
You can get the id of the one which was clicked liek this:
$('a[id*=dialog_link]').click(function(){
var id = $(this).attr('id');
console.log(id);
});
Problem
I have the following code ``` <td><a href="#" id="dialog_link-19" class="ui-state-default ui-corner-all">Click here</a></td> <td><a href="#" id="dialog_link-25" class="ui-state-default ui-corner-all">Click here</a></td> <td><a href="#" id="dialog_link-33" class="ui-state-default ui-corner-all">Click here</a></td> <td><a href="#" id="dialog_link-556" class="ui-state-default ui-corner-all">Click here</a></td> ``` `#dialog_link` is generated dynamically. in my js I need to know which was clicked. this is my js ``` $('#dialog').dialog({ autoOpen: false, width: 600, buttons: { "Ok": function() { $(this).dialog("close"); }, "Cancel": function() { $(this).dialog("close"); } } }); // Dialog Link $('#dialog_link').click(function(){ $('#dialog').dialog('open'); $.ajax({ url: "teams/pp", type: "POST", data: success: function( data ){ console.log(data); } }); return false; }); ```