Last active
August 29, 2015 14:04
-
-
Save filipkral/c4b907c216eb0b4619fa to your computer and use it in GitHub Desktop.
Function to load jQuery in a browser console or alike.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// self-executing oneliner to paste it to console | |
(function load_jQuery(){var jq = document.createElement('script'); jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; document.getElementsByTagName('head')[0].appendChild(jq); setTimeout(function(){ jQuery.noConflict(); console.log('jQuery should be available as jQuery now.'); }, 3000); })(); | |
// the above function in readable form | |
function load_jQuery(){ | |
// Load jQuery | |
// based on http://stackoverflow.com/questions/7474354/include-jquery-in-the-javascript-console | |
var jq = document.createElement('script'); | |
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// ... give time for script to load, then type. | |
setTimeout(function(){ | |
jQuery.noConflict(); | |
console.log('jQuery should be available as jQuery now.'); | |
}, 3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment