What is the difference between those two and when should I use each one of them?
Sometimes the script won't work unless I replace the $ with jQuery.
What is the difference between those two and when should I use each one of them?
Sometimes the script won't work unless I replace the $ with jQuery.
that's because $
is a shortcut for jQuery
and many other frameworks, which means they can overwrite this variable
if you want to use it, a good practice is to do the following:
(function($){
// here you can use $ and be sure it references jQuery
})(jQuery);
if you don't include any other frameworks on your website, then it makes no difference whether you use $
or jQuery
console.log(jQuery === $) // true