Home › Forums › Quform WordPress › Targeting [Custom Javascript] code per Form
- This topic has 5 replies, 2 voices, and was last updated 6 years, 5 months ago by
Ally.
- AuthorPosts
- October 10, 2018 at 11:49 pm #27146
katw
ParticipantHi 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:
- Remove all JS code from Custom Javascript field and use another plugin to load the JS in footer
- 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 6 years, 6 months ago by
katw. Reason: added alternate class name
October 12, 2018 at 5:01 pm #27171Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 14, 2018 at 11:51 pm #27193katw
ParticipantNice idea, thanks.
October 18, 2018 at 8:54 pm #27248katw
ParticipantWhat about the CSS?
October 18, 2018 at 8:59 pm #27249katw
ParticipantWould the order of loading (queuing) JS work out like this?
- Quform Plugin operational JS
- Quform Global Settings Custom JS
- quform_pre_display hook JS enqueued code
Or is 2 and 3 swapped?
Concerned about load order.
October 21, 2018 at 12:53 pm #27270Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.