Site icon Hip-Hop Website Design and Development

jQuery works in console but not when in a file

This is the code.

jQuery(document).ready(function() {
    jQuery( '#menu-item-927' ).on( 'ubermenuopen', function(){
      jQuery('.site-content').addClass('blur');
    });
});

It works when I use it in the console but does not work when in a JS file.

Here are the things I have tried:

  1. Enqueued script with jQuery dependency wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/custom.js', array( 'jquery' ), '1.0.0', false ); and custom.js does show up in the source.
  2. Added jQuery(document).ready(function().

P.S: ubermenuopen is an events API from the UberMenu plugin.