• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Problem loading javascript file

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Problem loading javascript file

This topic is: resolved

Tagged: javascript

  • This topic has 3 replies, 3 voices, and was last updated 12 years, 3 months ago by Blenderbox.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • June 4, 2014 at 3:48 pm #108105
    Blenderbox
    Member

    Hi, I'm having some problems adding a javascript file to my child-theme.

    I have this on my funtions.php file:

    function wpsites_register_load_script() {
    wp_register_script( 'custom', get_stylesheet_directory_uri() . '/js/custom.js', array( 'jquery' ) );
    wp_enqueue_script( 'custom' );
    }
    add_action( 'wp_enqueue_scripts', 'wpsites_register_load_script' );

    And I can see throw the Chrome inspector that the file is loaded correctly, but the function I have on the file is not working.

    I just put an alert on my custom.js file:

    $(document).ready(function(){
    $('.site-inner').click(function () {
    alert('Testing js');
    });
    });

    I don't know what i'm doing wrong but I really need help here.

    Thank you in advance!

    June 4, 2014 at 4:44 pm #108109
    lauriemrauch
    Member

    Howdy!

    Replace this code:
    $(document).ready(function(){

    with this:
    jQuery(document).ready(function($){

    that should get the rest of the code to play nice.

    Hope that helps!


    CodeDiva | WordPress Theme Development, Theme Customization, Theme Support & WordPress Coaching

    June 4, 2014 at 5:59 pm #108115
    bandj
    Member

    Love your site lauriemrauch

    June 5, 2014 at 1:37 am #108130
    Blenderbox
    Member

    Thank you lauriemrauch!

    I couldn't see the problem even though I've use the jQuery function many times before.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Problem loading javascript file’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble