Vanilla JS method breaks if jQuery is included
See original GitHub issueI’m developing a website in Wordpress where I use just vanilla JavaScript and no other frameworks, so while using Velocity I use function Velocity(...)
. While testing I need to activate the Debug Bar which relies on jQuery, but when doing it, Velocity is looking for jQuery method instead giving the error ReferenceError: Can't find variable: Velocity
. How can I resolve this issue? Sincerely, I don’t want to modify all the Velocity(...)
functions with jQuery callback and then modify them again when testing is done. Hope there’s a solution for this.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
Checking if jquery is loaded using Javascript - Stack Overflow
If the $(document) ready function runs at all, then jquery is loaded. So you could simply do $(document).ready(function(){ alert("Ready!"); }); ...
Read more >Subscribing to plugin events break vanilla javascript and jQuery
If I re-add the event listener, it starts working again. Example of event listener on my page: let myElement = document.getElementById('myButton ...
Read more >The Basics of DOM Manipulation in Vanilla JavaScript (No ...
The first one is that we can't call Node methods on the result and propagate them to its elements (like you might be...
Read more >How to do Everything jQuery can do with Vanilla JavaScript
It's time to come home to Vanilla JavaScript. These days there's nothing you can't do in jQuery that Vanilla JavaScript can't do just...
Read more >You Might Not Need jQuery
Examples of how to do common event, element, ajax and utility operations with plain javascript.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Currently Velocity says “Oh, here’s jQuery, let’s connect to that instead” (same for Zepto) - so it can’t do both, you need to add a line (after loading Velocity) to copy it over -
Alternatively you can try what I do and use an IIFE