Scriptbar Snippets 🚀
Handy and easy to understand snippets to keep in your browser


Add jquery to current page if it doesn't exist already

Script include jquery to current page if it is not yet included

(function () { if (!window.jQuery) { var dollarInUse = !!window.$; var s = document.createElement('script'); s.setAttribute('src', '//'); s.addEventListener('load', function () { console.log('jQuery loaded!'); if (dollarInUse) { jQuery.noConflict(); console.log('`$` already in use; use `jQuery`'); } }); document.body.appendChild(s); } })();
Built with ❤️ by @domnguyen and everyone on the internet 🚀