David2021 Posted January 25, 2022 Posted January 25, 2022 Hi there, I have injected some JQuery code into my page in order to set a few conditional fields within a form. The conditional fields are triggered depending on the selection from a radio button as shown below: As you can see when a number other than 0 is selected the conditional fields get displayed. The form works perfectly as expected but the problem is when I switch to form to a lightbox the JQuery seems to stop working and the conditional fields do not appear, no matter the selection. What am I missing here? Any help on this would be appreciated 🙂 Â
paul2009 Posted January 25, 2022 Posted January 25, 2022 The code must wait until the form has loaded, not the page. When the form is on the page, both load at the same time but when it is a lightbox form it won't be added to the page until the form is launched. David2021 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
David2021 Posted January 26, 2022 Author Posted January 26, 2022 19 hours ago, paul2009 said: The code must wait until the form has loaded, not the page. When the form is on the page, both load at the same time but when it is a lightbox form it won't be added to the page until the form is launched. Thanks Paul, would you have an example of code that would work for recognising if the form is launched or not? I have tried these examples below so far: $('#yui_3_17_2_1_1643211118624_394').on( "load", function() { }); if($('#yui_3_17_2_1_1643211118624_394').is(':visible')){ } Â
paul2009 Posted January 26, 2022 Posted January 26, 2022 It's more complex than that 🙂. You'll need a Mutation Observer to detect the changes. Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
David2021 Posted January 26, 2022 Author Posted January 26, 2022 Ok I'll give that a shot, thanks 😃
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment