Own JS not working in WordPress [duplicate]

This question already has an answer here:

I’m loading my own JS file in the footer for a new WordPress theme. I see the file in source code loaded in the footer, but nothing happens with the files functions.

Loading the files:

function loading_stuff() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true );
wp_enqueue_script( 'jquery' );

wp_register_style( 'stylesheet', THEME_DIR . '/style.css', array(), '1', 'all' );
wp_enqueue_style( 'stylesheet' );

wp_enqueue_script( 'fontawesome', 'https://use.fontawesome.com/b086a29891.js', false, NULL, true );
wp_enqueue_script( 'mainjs', get_template_directory_uri() . '/assets/js/main.js', array ( 'jquery' ), 1.1, true); 

add_action( 'wp_enqueue_scripts', 'loading_stuff' );

Custom JS action:

$('#menu-toggle').click( function() {
} );

Though, nothing happens when I click the #menu-toggle div.

Read more here: Own JS not working in WordPress [duplicate]

Leave a Reply

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