Close lightbox after the form submitted

Please I want to close the lightbox after two seconds the user click send button and the form is succesfully complete, my product page is www.galvanoschl.cl/galvanos/emblema-de-honor.

Anyone can help me with the code? I am a neeewbiee! Pleaseeee!

Thank in advance guys!

Hi,
You can use the Wix Window API to close the lightbox, as explained here . The function should be used in the onAfterSave method. The code should be added to the lightbox code section:

 import wixWindow from 'wix-window';
 
 $w("#myDataset").onAfterSave( () => {   
    console.log("After save"); 
    wixWindow.lightbox.close();
 } );

I hope it’s clear.

Best,
Tal.

How do we get the dataset id?

You can get id of any element on your page by hovering over it and seeing the #name at the top left. Or you can click on the element and look in the properties panel for it.

Old post from 2018 being closed.