Title: jQery code not executing
Last modified: January 16, 2020

---

# jQery code not executing

 *  Resolved [florianw7](https://wordpress.org/support/users/florianw7/)
 * (@florianw7)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/)
 * Hi! I have three separate code snippets which execute the same jQuery code, but
   are using different classes and IDs.
 * I have this weird behaviour, when I deactivate the first code snippet, only the
   two others work and if I activate it again only the first code snippet works.
   I tried playing around with the priorities and got it to work (all three working)
   at some point, but now it’s the same behaviour as desrcibed above again.
 * I really don’t understand why it doesnt execute the jQuery code from all three
   snippets.
 * Really looking forward to your replys,
    Florian

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

 *  [tapiohuuhaa](https://wordpress.org/support/users/tapiohuuhaa/)
 * (@tapiohuuhaa)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12331655)
 * I assume that you have added code by using wp_head() hook.
    Have you looked the
   source code that all exists. Code Snippet doesn’t thoroughly check the syntax
   of JavaScript. Code Snippet in such doesn’t execute any JavaScript code. It just
   generates is. If some generated JavaScript does not exist, have you activated
   all related snippets? If all exist, this is not a Code Snippet issue at all except
   that setting priorities it affects the order of JavaScripts.
 *  Thread Starter [florianw7](https://wordpress.org/support/users/florianw7/)
 * (@florianw7)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12331700)
 * Hi, thanks for your reply!
 * Yes I’m using “add_action(‘wp_head’, function() { ?>
    I’m not quite sure what
   you mean with “looking at the source code”. All required code snippets are activated.
 *  [tapiohuuhaa](https://wordpress.org/support/users/tapiohuuhaa/)
 * (@tapiohuuhaa)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12331720)
 * “looking at the source code”.
 * You can see the generated code by looking the source code between HEAD tags. 
   If all JavaScript is there and script tags are in correct order, this is not 
   a Code Snippet issue.
 * You should check JavaScript and CSS by copying the code to some editor, which
   checks the validity of JS and CSS.
 * Code Snippet checks from JS just that some marks have pairs ( [],(),{},”,”” ).
   It checks them from JS quite reliable.
 * Concering CSS it works unreliable and can’t check properly { + }. That can also
   cause, that { + } are marked sometimes invalid also for PHP code. Fortunately
   Code Snippet doesn’t accept invalid PHP – **BUT it saves temporary invalid PHP**,
   which might crash your site! Don’t create backend snippets, if you don’t have
   checked the snippet elsewhere!
    -  This reply was modified 6 years, 4 months ago by [tapiohuuhaa](https://wordpress.org/support/users/tapiohuuhaa/).
 *  Thread Starter [florianw7](https://wordpress.org/support/users/florianw7/)
 * (@florianw7)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12331749)
 * Just checked it out chrome inspect mode. It shows all the required code in the
   right order in between the <head> tag.
 * Also checked the code out in Visual Studio Code, it shows no syntax errors!
 * Really beginning to think that it’s not a code snippets issue.
 *  [tapiohuuhaa](https://wordpress.org/support/users/tapiohuuhaa/)
 * (@tapiohuuhaa)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12331790)
 * Code Snippet has been run by server.
    JavaScript will be run by the browser. 
   Maybe you have duplicate function definitions.
 * BTW. Vivaldi is more versatile browser than Chrome. It use the same “engine” 
   as Chrome, but you can tile window into several parts and you have additional
   sidebar on the left, where is notebook and possibility to add some special pages.
   I use 2-3 windows side by side (temporary sidebar and two tiled windows side 
   by side, where left I edit the page and right I see, how it looks like). Because
   it shows like Chrome, I don’t use Chrome at all. Chrome is for Vivaldi just a
   kind of platform, which Vivald has been build more versatile interface.
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12331904)
 * Hi [@florianw7](https://wordpress.org/support/users/florianw7/),
 * One thing I can think of is that perhaps the jQuery library is not loading as
   expected.
 * What method are you using to load jQuery on the front-end?
 * And are you writing your code in no conflict mode? i.e. using `jQuery` instead
   of `$`?
 *  Thread Starter [florianw7](https://wordpress.org/support/users/florianw7/)
 * (@florianw7)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12331929)
 * Hi [@bungeshea](https://wordpress.org/support/users/bungeshea/),
 * Can you pls clarify “What method are you using to load jQuery on the-front?” 
   a bit more for me?
 * I’ve been using $, will try it with “jQuery” when I’m back at my computer!
    -  This reply was modified 6 years, 4 months ago by [florianw7](https://wordpress.org/support/users/florianw7/).
 *  Thread Starter [florianw7](https://wordpress.org/support/users/florianw7/)
 * (@florianw7)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12332745)
 * I tried it now in no conflict mode, but it’s not working / same behaviour as 
   before.
 * [@bungeshea](https://wordpress.org/support/users/bungeshea/) would you be so 
   kind and check it out for yourself, if you have the time? I would share the login
   details with you.
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12333265)
 * Hi florianw7,
 * You will also need to make sure the jQuery library itself is loaded on the page
   before your scripts execute. Can you see it linked if you view the page source?
 * WordPress does not load jQuery on the front-end of your site by default.
 *  Thread Starter [florianw7](https://wordpress.org/support/users/florianw7/)
 * (@florianw7)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12333352)
 * Hi Shea
 * yes it is linked, I see this in my source code:
 * `<script type="text/javascript" src="https://formlos.at/wp-includes/js/jquery/
   jquery.js"></script>`
 * As I described above, half of my code is working if I disable some code snippets.
   I also checked it several times with visual studio code for syntax errors.
 * It may be conflicting with another plugin or something else on my site.
    -  This reply was modified 6 years, 4 months ago by [florianw7](https://wordpress.org/support/users/florianw7/).
 *  Thread Starter [florianw7](https://wordpress.org/support/users/florianw7/)
 * (@florianw7)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12333499)
 * Issue resolved, it actually was a typo.
 * Thank you guys anway for your help!
    -  This reply was modified 6 years, 4 months ago by [florianw7](https://wordpress.org/support/users/florianw7/).
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12333546)
 * Glad to hear it’s working now!

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

The topic ‘jQery code not executing’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 12 replies
 * 3 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/jqery-code-not-executing/#post-12333546)
 * Status: resolved