Targeting [Custom Javascript] code per Form

Home Forums Quform WordPress Targeting [Custom Javascript] code per Form

This topic is: resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #27146
    katw
    Participant

    Hi Ally,

    Is there a way to segregate the custom javascript on a form ID basis so only the javascript belonging to the particular form is loaded/linked?

    Have you got sneaky comment tags I can insert to mark “start and end” for each OR a filter hook I can tap into to override/change the JS file or content linked?

    I’m guessing no?

    So my thinking is I have two options:

    1. Remove all JS code from Custom Javascript field and use another plugin to load the JS in footer
    2. Add an IF/THEN check for presence of class quform-1 or .quform-form-1 around code for form one and similar idea for form 2.

    Any other suggestions/solutions?

    Thanks Kat

    • This topic was modified 5 years, 6 months ago by katw. Reason: added alternate class name
    #27171
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #27193
    katw
    Participant

    Nice idea, thanks.

    #27248
    katw
    Participant

    What about the CSS?

    #27249
    katw
    Participant

    Would the order of loading (queuing) JS work out like this?

    1. Quform Plugin operational JS
    2. Quform Global Settings Custom JS
    3. quform_pre_display hook JS enqueued code

    Or is 2 and 3 swapped?

    Concerned about load order.

    #27270
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy