Google Chrome – How to run jQuery in console

Many times I need to test some elements in some web pages which I don’t own. 
If that webpage uses jQuery then it’s quite easy for us to do our testing; but if jQuery is not there, it’s a headache to do kinds of stuff with native JavaScript, because jQuery is always a better DOM manipulator.

To make our life easy, you can insert jQuery on that webpage from your browser’s console. All you need to do is to copy-paste and run the following code in the console.

 

var jq = document.createElement('script');

jq.src = "https://code.jquery.com/jquery-3.1.1.min.js";

jq.onload = function(){

jQuery.noConflict();
}
document.getElementsByTagName('head')[0].appendChild(jq);

 

After that, you can do what you want with jQuery on the console ^^

 

Revisions

No comments yet.

Leave a Reply