• Resolved thairish

    (@thairish)


    Hi,

    I am using a theme called Kleo. I need to write some custom jQuery code so which I have used using wp_enqueue_scripts and using jquery as a dependency (https://codex.www.ads-software.com/Function_Reference/wp_enqueue_script#Link_a_Theme_Script_Which_Depends_on_jQuery)

    My custom js file is called and if I do a console.log it works fine. However any kind of jQuery is not working. For example:

    jQuery(“#logo_img”).css(“display”, “none”);

    (using ‘$’ will give an error in console)

    Using this kind of code I don’t have any kind of errors showing in console and I’m not sure why it’s not working (#logo_img does exist). If I type that above code in console it does work.

    Any help is much appreciated, thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter thairish

    (@thairish)

    Just fixed this, need to wrap the custom code in:

    jQuery(document).ready(function(){
    //Custom code
    });

Viewing 1 replies (of 1 total)
  • The topic ‘JQuery code not working on theme’ is closed to new replies.