Support » Plugin: Simple Custom CSS and JS » JS codes don’t work

  • Resolved pickme

    (@pickme)


    Hi!

    After WP 5.3 update, the JS codes do not work. With WP 5.2.4 they were working fine.

    Is this a compatibility problem with WP 5.3 and Simple Custom CSS and JS 3.28 ?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Diana Burduja

    (@diana_burduja)

    Hello,

    I am not aware of any incompatibility between the plugin and WP 5.3. On my test website everything seems to be working alright.

    Do you have a link so I could have a look?

    Yes

    I get TypeError: $ is not a function for several codes.
    I am not getting this error with WP 5.2.4

    • This reply was modified 4 months, 2 weeks ago by pickme.
    • This reply was modified 4 months, 2 weeks ago by pickme.
    Plugin Author Diana Burduja

    (@diana_burduja)

    You can fix the errors by replacing the $. with jQuery. in the codes.

    For example, the following code:

    $(document).ready(function() {
        $(".nav-menu-mobile").find("a").on("click", function(e){
            $("a.hamburger-icon.toggle-mobile-menu").trigger("click");
        });
    });

    needs to be rewritten as follows:

    jQuery(document).ready(function($) {
        $(".nav-menu-mobile").find("a").on("click", function(e){
            $("a.hamburger-icon.toggle-mobile-menu").trigger("click");
        });
    });

    Here is an article about “compatibility mode” for jQuery in WordPress.

    The issue has nothing to do with the Simple Custom CSS and JS plugin per se. It has to do with the wrong use of the jQuery library in WordPress.

    • This reply was modified 4 months, 2 weeks ago by Diana Burduja.

    Thank you for your help Diana!
    It did work!
    Nothing to do with Simple Custom CSS and JS.

    • This reply was modified 4 months, 2 weeks ago by pickme.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.