Archived topic
Defer Javascript Element Conflict
1 reply · Started by Ty on November 3, 2019
I have a custom calculator I made with jQuery that has worked great until Siteground added "Defer Render Blocking JS" as a setting to their SG Optimizer Plugin.
The jQuery I coded is inserted into one post using the elements feature in Generate Press. It currently goes in the 'wp_footer' hook.
When I have the render blocking setting turned off in the SG Optimizer Plugin it works fine, and does not work at all when I turn it on. When turned on it gives a console error that it doesn't recognize 'jQuery' function, so I am assuming it is not loading jQuery before the element's code.
Is there a way I can get these two things to play together? I would like to have it turned on but open to other ideas.
Hi there,
we see quite a few issues raised that are related to SG Optimizer messing with the order of things. We recommend autoptimize as its less prone to this - tips here:
https://generatepress.com/fastest-wordpress-theme/
Try that and if that works then the issue is SG plugin messing things around.