Scriptbar Snippets 🚀
Handy and easy to understand snippets to keep in your browser
add-jquery-to-page.js

#Basic

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', '//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js'); 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 🚀