Select2() is not a function The best way to know if JQuery is available?
Hey guys. I've been trying to implement select2 to my project and I get this error that jQuery(...).select2() is not a function
. And what I've found is that jQuery might be loaded for a couple of times and that's why the error appears. I know that jQuery works fine since jQuery.fn.jquery
returns the installed version of it. However I'm not sure if this is the case, but it seems that it's the most possible, since I'm using Bootstrap, quicksandjs and other plugins that might import the jQuery multiple times to the project.
How could I check if the jQuery is loaded the second time and how could I prevent it from loading again? Many thanks.