Created
June 11, 2020 20:08
-
-
Save djD-REK/423cd380bab1f1f26448554d0fa6ccfe to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Load jQuery, equivalent to having the <script> tag on the page | |
// <script src="https://code.jquery.com/jquery-3.5.0.js"></script> | |
const loadScript = async (url) => { | |
const response = await fetch(url) | |
const script = await response.text() | |
eval(script) // or Function(script) | |
} | |
const scriptUrl = "https://code.jquery.com/jquery-3.5.0.js" | |
loadScript(scriptUrl) | |
// In the browser console, you need to enter and run the above commands to load | |
// jQuery first, separately, before you can actually use it in the console: | |
// Select all <div> elements on the page | |
const jQueryDivs = $("div") | |
// Apply CSS styles to the selected <div> elements | |
jQueryDivs.css("border", "3px solid orange") | |
// As a one-liner: | |
$("div").css("border", "3px solid orange") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment