logo
Ask your Javascript questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$10
jQuery question: How can I add a callback to closeDOMWindow

I'm using the code from this page.

If you click one link, then the lightbox pops up. I've got this code to set the action on the link:

    if ($('#link_to_create_a_new_country_from_the_region_form')) {
$('#link_to_create_a_new_country_from_the_region_form').openDOMWindow({
eventType:'click',
height:260,
width:350,
loader:1,
loaderImagePath:'/images/animationProcessing.gif',
loaderHeight:16,
loaderWidth:17
});
}



If you click another link, the pop up closes. I've got this code setting the action to click for that link:


if ($('#link_to_close_new_country_form_on_region_form_page')) {
$('#link_to_close_new_country_form_on_region_form_page').closeDOMWindow( {
eventType:'click',
});
}



Only problem is, when you close the pop up, I need a lot of other stuff to happen. I need to update some form inputs.

But how do I get other stuff to happen? I have not been able to figure out how to get other code to trigger when you click that close link.

Does jQuery have an easy way to set several actions on the click? I could write some manual code to do this (I've done stuff like that using a modified version of Simon Willison's addLoad script) but I worry I will break something in jQuery if I do this.

This question has been answered.

Lawrence Krubner | 01/14/11 at 2:31pm Edit


(3) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    01/18/11
    10:45am
    Jarret Minkler says:

    add this option replacing null with your fnc

    functionCallOnClose:null,

    and you want to remove the training commas in the {} otherwise IE will cry

    Previous versions of this answer: 01/14/11 at 3:02pm

  • avatar
    Last edited:
    01/18/11
    10:45am
    Bill Hunt says:

    This doesn't directly answer the question, but that plugin doesn't really seem to be doing things the "jquery way". I'd strongly recommend using the jQuery UI library's dialog function instead, and just attach it to a click through the usual event handlers.

  • avatar
    Last edited:
    01/18/11
    10:45am
    Eric Hamilton says:

    Add a class to the dom window close links, then do:


    $('body').delegate('.my-close-links', 'click', function () {
    // do stuff....
    // $(this) will be the clicked link.
    // You can use .parent( [ selector ] ) to find parent elements of the clicked link.
    });


    I agree that jQuery UI's built-in .dialog() might be a better solution for you. With it, you can do:


    $( ".selector" ).load('someurl').dialog({
    buttons: {
    "Close": function () {

    // Insert whatever you want here...

    $(this).dialog("close");
    }
    }
    });

    Previous versions of this answer: 01/15/11 at 1:02am | 01/15/11 at 1:13am | 01/15/11 at 1:13am

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.