Webflow loads the jQuery library at the bottom of the BODY tag and we need a way to check if the library is loaded before we can use it.
The last post I found about this topic is quite old, so I was wondering if the Webflow javascript wrapper is still considered best-practice.
This post mentions the wrapper:
var Webflow = Webflow || [];
Webflow.push(function () {
// DOMready has fired
// May now use jQuery and Webflow api
});
Is this still the recommended method?
Another alternative would be:
window.addEventListener('DOMContentLoaded', (event) => {
// DOMready has fired
// May now use jQuery
});
To add to the confusion I found this post on the Webflow blog where they include the jQuery library manually on the Settings/Custom Code of the page.
Any thoughts?