Get the id of the link and pass it to the jQueryUI dialog widget
- by Mike Sanchez
I'm using the dialog widget of jQueryUI. Now, the links are grabbed from an SQL database by using jQuery+AJAX which is the reason why I used "live"
$(function() {
var $dialog = $('#report')
.dialog({
autoOpen: false,
resizable: false,
modal: true,
height: 410,
width: 350,
draggable: true
})
//store reference to placeholders
$uid = $('#reportUniqueId');
$('.reportopen').live("click", function (e) {
$dialog.dialog('open');
var $uid = $(this).attr('id');
e.preventDefault();
});
});
My question is, how do I pass the id of the link that triggered the dialog widget to the dialog box itself? The link is set up like this:
<td align="left" width="12%">
<span id="notes">
[<a href="javascript:void(0)" class="reportopen" id="<?=$reportId;?>">Spam</a>]
</span>
</td>
And the dialogbox is set up like this:
<div id="report" title="Inquire now">
HAHAHAHAHA
<span id="reportUniqueId"></span>
</div>
I'd like for the id to be passed and generated in the <span id="reportUniqueId"></span> part of the dialog box.
Any idea?