I am having some trouble with jQuery. I want to have a dialog box appear when the user clicks a link to delete something and prompt them to be sure that they actually want to delete it. The dialog box appears fine however I don't see a way to get the url of the link when user clicks the "Yes" button. I tried using the event.relatedTarget property to get the url of the a tag but it is null. Does anyone know how to do this?
Code
<div id="dialog" title="Delete Run">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 0 0;"></span>Are you sure you want to delete that run?</p>
</div>
$(document).ready(function() {
$('#dialog').dialog({
autoOpen: false,
width: 400,
modal: true,
draggable: false,
resizable: false,
buttons: {
"Yes": function(event) {
//Go to the url in $("a.delete")
},
"No": function() {
$(this).dialog("close");
}
}
});
$("a.delete").click(function(){
var url = $(this).attr("href");
$('#dialog').dialog('open');
return false;
});
});