Created
May 10, 2012 22:06
-
-
Save zxcvbnm4709/2656197 to your computer and use it in GitHub Desktop.
include jQuery in Chrome Console
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
var script = document.createElement("script"); | |
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); |
Always use let ;)
let script = document.createElement("script");
script.setAttribute('src', '//code.jquery.com/jquery-latest.min.js');
script.addEventListener('load', function() {
let script = document.createElement('script');
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
I couldn't get this to work with what I was doing. This one worked for me and it uses promises:
fetch('https://code.jquery.com/jquery-latest.min.js')
.then(r => r.text())
.then(r => { Function(`'use strict'; ${r}`)() });
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Always use the latest: