javascript tutorial - [Solved-5 Solutions] Include jQuery in the javascript console - javascript - java script - javascript array
Problem:
Is there an easy way to include jQuery in the Chrome JavaScript console for sites that do not use it ? For example, on a website we would like to get the number of rows in a table. We know this is really easy with jQuery.
The site does not use jQuery. Can we add it in from the command line?
Solution 1:
Run this in our browser's JavaScript console, then jQuery should be available...
NOTE: if the site has scripts that conflict with jQuery (other libs, etc.) we could still run into problems. Update:
Making the best better, creating a Bookmark makes it really convenient, let's do it, and a little feedback is great too:
- Right click the Bookmarks Bar, and click Add Page
- Name it as we like, e.g. Inject jQuery, and use the following line for URL:
Below is the formatted code:
Here the official jQuery CDN URL is used, feel free to use our own CDN/version
Solution 2:
Run this in our console
It creates new script tag, fills it with jQuery and appends to head
Solution 3:
Use the jQueryify booklet:
Instead of copy pasting the code in the other answers, this'll make it a clickable bookmark.
Solution 4:
- FWIW, Firebug embeds the
include
special command, and jquery is aliased by default: - So in our case, we just have to type :
Solution 5:
One of the shortest ways would be just copy pasting the code below to the console.