You should place the whole function/script inside a so called IIFE like this:
(function($){
//your code
})(jQuery);
In WordPress the $ isn’t attached to jQuery by default due to possible conflicts with other JavaScript libraries.
You should place the whole function/script inside a so called IIFE like this:
(function($){
//your code
})(jQuery);
In WordPress the $ isn’t attached to jQuery by default due to possible conflicts with other JavaScript libraries.