Wednesday, May 22, 2013

Add jQuery to almost any site from the console!

I know i seriously need to update my blog. But for now, a new fun entry!

Have you ever been to a site and wanted to manipulate some stuff on the site with ease? Without long lines of vanilla JS? The following code snippet will help you do exactly that! Simply open the console, paste the code, hit enter/submit and you're good to go! Have fun editing that site to look however you want! Enjoy!

if(typeof jQuery === 'undefined') {
 // jQuery site src: https://code.jquery.com/jquery-1.9.1.min.js
 var $script = document.createElement("script");
 $script.src = "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";
 $script.type = "text/javascript";
 document.getElementsByTagName('head')[0].appendChild($script);
}

OR

Just go add "cjs" to your Chrome browser and do about the same thing!