I\'m viewing a webpage using Chrome. The original source does not include jQuery, but it\'d be really helpful to use some jQuery functions to inspect the DOM. It would be a pain
This is the JS code snippet I use frequently to tackle this problem.
It's the same as Matt's but wrapped in an IIFE to make it easier for you or any other person to fire up jQuery in your browser environment just like that.
(function() {
var h = document.head;
var scr = document.createElement('script');
scr.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js';
h.appendChild(scr);
})();
If you would like to use $
function name for other non jQuery related functionality, you can relinquish $
and assign your jQuery function to another name or back to the original form jQuery()
by calling the $.noConflict()
method as advised by Matt above.