Matt
Matt

Reputation: 2170

Load JQuery into any page using Firebug

Does anyone have a snippet to load jquery onto any page from firebug? I often come across sites that I would prefer to inspect using familiar jq syntax.

For example, say I want to extract a list of prices from a page - it would be nice to launch firebug, install jquery from the google CDN, and type $('li.prices').each(...).

Upvotes: 15

Views: 8856

Answers (5)

Another way is to paste this to the Firebug console and hit the execute button.

var fileref = document.createElement("script");
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", "http://code.jquery.com/jquery-latest.min.js");
document.head.appendChild(fileref);

UPDATE: Use following snippet to inject jQuery into a website that uses HTTPS:

var fileref = document.createElement("script");
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", "https://code.jquery.com/jquery-latest.min.js");
document.head.appendChild(fileref);

Upvotes: 7

glancep
glancep

Reputation: 356

You can also use the include function from the Console with either the URL to jQuery or by using the predefined alias, like this:

include("jquery")

See here for more detail.

Upvotes: 3

Chad
Chad

Reputation: 1404

check out jQuerify

Upvotes: 1

EMiller
EMiller

Reputation: 1148

Just saw this bookmarklet for injecting jQuery in another thread

Upvotes: 14

PetersenDidIt
PetersenDidIt

Reputation: 25620

Check out FireQuery

Upvotes: 3

Related Questions