I have a page with multiple modal jQuery UI dialogs, I am trying to make a link on one dialog (faq) that will close that dialog and open another one (warranty). Below is the relevant code:
var $faqIframe = $('<iframe />', {
name: 'myFrame',
id: 'myFrame',
src: "modal_faq.html",
width:"100%",
height:"100%",
align:"left",
scrolling:"auto",
frameborder:"0"
});
var $warrantiesIframe = $('<iframe />', {
name: 'myFrame1',
id: 'myFrame1',
src: "modal_warranties.html",
width:"100%",
height:"100%",
align:"left",
scrolling:"auto",
frameborder:"0"
});
and then, to open the faq iFrame
$(function(){
$('#faqDialog').dialog({
autoOpen: false,
width: 780,
height: 460,
modal: true
});
$('#faqDialog').append($faqIframe.clone());
// Dialog Link
$('#faq_link, #faq_link1').click(function(){
$('#faqDialog').dialog('open');
return false;
});
This works fine, opens the dialog as expected. I have similar code for the warranty dialog as well. This is the code that is currently not working. #warranty_link2 is a link on the faq dialog that, when clicked, I would like to trigger the closing of the faq dialog.
$('#warranty_link2').on("click", function(event){
$('#faqDialog').dialog('close');
});
}
I have tried
$('#faqDialog').dialog('close');
$('#faqDialog').dialog('hide');
$('#faqDialog').dialog('destroy');
I have also tried with 'live' instead of 'on', and without either of those two as well Also tried referencing it with the var $faqIframe, as in
$faqIframe.dialog('close')
with no results.
I know the click event is firing because I put in a console.log which worked.
What am I doing wrong and how can I get this dialog to close?
See it in action at http://www.solarkit2go.com - click the faq link