How do I capture a Modal close button event
Total NB here.
I have a function that opens a modal window, when one of many lightbox buttons is clicked.
Ajax will pull the info for each individual lightbox.
However, since I have several other buttons on the same page, it opens the "myLightbox-dialog" window.
Is there a way I can capture a different button click just before calling the dialgo('open')?
thank you in advance.
MIke
$("#lightbox-manage-dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 100,
modal: true,
});
// When a lightbox button is clicked open a dialog
$("button").click(function() {
$('#myLightbox-dialog').dialog('open');
// Set the Title of the Dialog
var title = $(this).text();
$("#myLightbox-dialog").dialog("option","title",title+" Lightbox");
})
.hover(
function(){
$(this).addClass("ui-state-hover");
},
function(){
$(this).removeClass("ui-state-hover");
}
).mousedown(function(){
$(this).addClass("ui-state-active");
})
.mouseup(function(){
$(this).removeClass("ui-state-active");
});
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<?php
if($count>0){
foreach($array as $key=>$value){
?>
<p style="padding: 5px 0px;">
<button name="<?php echo $value; ?>" id="myLightbox" class="ui-button ui-state-default ui-corner-all" onClick="getLightboxContents(<?php echo $key; ?>, <?php echo $value; ?>)"><?php echo $value; ?></button>
<a href="lightbox/lightbox-manage.php" id="lightbox-manage" name="lightbox_manage_modal" title="<?php echo $value; ?>" onClick="lightbox_manage(<?php echo $key; ?>)">manage lightbox</a>
| <a href="#" id="lightbox-delete" name="lightbox-delete" title="<?php echo $value; ?>" rel="<?php echo $key; ?>" onClick="lightbox_deletes(<?php echo $key; ?>)">delete lightbox</a>
</p>
<?php }}else{ ?>
<p>There are no lightboxes! Please create a lightbox.</p>
<?php } ?>
</td>
</tr>
</table>
<div id="myLightbox-dialog" title=""></div>
<div id="lightbox-manage-dialog" title=""></div>