Not able to close Dialog from parent dialog reference
- by coffeeaddict
In the dialog content, I have this:
<script type="text/javascript">
$(function() {
$("#cancel").click(function(o) {
alert(parent.$('#dialog'));
parent.$("#dialog").dialog("close");
o.preventDefault();
});
});
</script>
and also tried this:
<script type="text/javascript">
$(function() {
$("#cancel").click(function(o) {
$(this).closest("#dialog").dialog("close");
o.preventDefault();
});
});
</script>
<a id="cancel" href="#"><img src="images/cancelBtn.gif" /></a>
This code again is the content of my dialog. When the user clicks the hyperlink I'm trying to close the parent dialog (the dialog that this content is in) but it's not doing anything. I know that the alert gets hit and that there is an object for parent.$('#dialog'); so not sure why it won't close the parent dialog