custom js script is not loading

I am trying to load a custom js script in my storefront child theme.
But the script doesn’t load anymore (after upgrading a few plugins).

My js script is in /wp-content/themes/HemenTheme.
I have this in my functions.php:

function my_scripts_method() {
wp_enqueue_script(
‘custom-script’,
get_stylesheet_directory_uri() . ‘/custom_menu_script.js’,
array( ‘jquery’ )
);
echo get_stylesheet_directory_uri() . ‘/custom_menu_script.js’;
}
add_action( ‘wp_enqueue_scripts’, ‘my_scripts_method’ );

the echo gives :

<mydomaine>/wp-content/themes/HemenTheme/custom_menu_script.js

but the js code in the script is not run.

here’s the begining of the js script:

console.log(“on est dans le script avant doc ready”);

jQuery( document ).ready( function() {

console.log(“on est dans le script”);

/*toggle du sous menu DESKTOP ET MOBILE*/
var masthead = jQuery( ‘#masthead’ );
var siteNavigation = masthead.find( ‘.main-navigation > div > ul’ );
siteNavigation.find( ‘a’ ).off( ‘focus.storefront blur.storefront touchstart.storefront resize.storefront’);

EDIT: I tried this https://wordpress.stackexchange.com/a/255217/121787. But it doesn’t work.

Read more here:: custom js script is not loading

Leave a Reply

Your email address will not be published. Required fields are marked *