Title: inlining the javascript gives jquery error
Last modified: January 21, 2019

---

# inlining the javascript gives jquery error

 *  Resolved [yeahfree](https://wordpress.org/support/users/yeahfree/)
 * (@yeahfree)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/inlining-the-javascript-gives-jquery-error/)
 * because the inline javascript code is being executed apparantly already before
   the jquery.js has been loaded i’m receiving an error:
    Uncaught referenceError:
   jQuery is not defined
 * besides from that, i would prefer this code not to be inline, as i’m running 
   my sites on http/2, which makes it load on every page refresh. if it would be
   in a separate file it could be cached, and also be stored on a cdn for better
   performance. also on http/1.1 this could be beneficial, as all javascript could
   be minified and stored into 1 file on a cdn.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/inlining-the-javascript-gives-jquery-error/#post-11112133)
 * Hi, if jQuery has not been loaded before the inline code, that probably means
   your theme or another plugin is forcing the jquery library to a (much) later 
   time than usual. To move the inline code to an even later point, there is the
   option “FancyBox script priority” in the Theme & plugins compatibility section
   on Settings > Media.
 * Set it to 99 and try again.
 *  Thread Starter [yeahfree](https://wordpress.org/support/users/yeahfree/)
 * (@yeahfree)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/inlining-the-javascript-gives-jquery-error/#post-11113273)
 * Hi RavanH, thanks for the quick response, putting it on 99 worked.
 * Now i only have the second part of my questions left, can the current inline 
   javascript also be placed in a file instead of as inline code?
 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/inlining-the-javascript-gives-jquery-error/#post-11118382)
 * No, the inline script is dynamic (depends on your settings on Settings > Media)
   so it cannot live in a static file…
 *  Thread Starter [yeahfree](https://wordpress.org/support/users/yeahfree/)
 * (@yeahfree)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/inlining-the-javascript-gives-jquery-error/#post-11119576)
 * ok i understand. it could be written to a file, since it will only change whenever
   changes would be made in the settings, but i guess that’s out of the scope for
   this plugin to implement.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘inlining the javascript gives jquery error’ is closed to new replies.

 * ![](https://ps.w.org/easy-fancybox/assets/icon-256x256.png?rev=3188201)
 * [Firelight Lightbox](https://wordpress.org/plugins/easy-fancybox/)
 * [Support Threads](https://wordpress.org/support/plugin/easy-fancybox/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-fancybox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-fancybox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-fancybox/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [yeahfree](https://wordpress.org/support/users/yeahfree/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/inlining-the-javascript-gives-jquery-error/#post-11119576)
 * Status: resolved