Using $ instead of jQuery in WordPress

Are you looking to use the dollar sign ($) instead of jQuery in WordPress? All you need to do is wrap your jQuery with a specific function.

Using the document ready function

To use $ instead of jQuery, provided you’ve enqueued jQuery already, you need to wrap your function using the document ready function.

jQuery( document ).ready( function( $ ) {
     $( '#element' ).on( 'click', function() {
          console.log( 123 );
     } );