Search code examples
jqueryfancybox

Closing fancybox and adding class to an item in parent in jquery


Basically have a page which launches a modal (fancybox), then a button in the modal window which needs to close the modal and then add a class to an element on the page that's beneath the modal.

I've been doing this inline for various reasons (the setup is a little confusing), the code I have on the is this:

onclick='$.fancybox.close(); parent($('#message-whitepaper').addClass('active'));'

I think I must have the parent part incorrect or something, have tried various combinations with no luck, if anyone can point out what i've done wrong that'd be great.

Thanks!


Solution

  • Think Different answered above:

    Then you can do

    onclick='$.fancybox.close(); 
    $('#message-whitepaper').addClass('active');
    

    simple just remove parent()
    Think Different Jan 16 at 13:00