Web Lucas
Coming back fresh ...
Calendar 06.05.2021

WordPress has its own version of the jQuery library and using $ operator will end up with js errors in your browser console. The solution is to enqueue jQuery if you haven’t already then add a wrapper function.

Enqueue the jQuery library

To use jQuery in your themes and plugins you have to enqueue the script. in your functions.php file.


Add a wrapper function

Now let’s add this jQuery wrapper function:

(function($) {
	// $ Test it with the next line if you like
	// console.log($);
})( jQuery );

Now you can use $ instead of jQuery prefix in your scripts. Enjoy 🙂

Thanks for your time,
Best regards. Lucas.