stack
stack

Reputation: 10228

Is it possible to attach jQuery to a loaded page?

I need to attach jQuery to a web page which is completely loaded. For example, I want to attach jQuery to this current page (stackoverflow) and then use it.

Well I did it:

enter image description here

But I don't see any reaction of the code I've written. I mean that alert won't be shown when I click on the document.

Anyway, is it possible to I attach a library like jQuery to a loaded page and writing some JS codes in it?

Upvotes: 1

Views: 47

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

If you are just trying to add some onclick handler to the document using your browser, then simply open the console and type the following:

document.onclick = function() { alert("document clicked"); };

Then go clicking around:

enter image description here

Upvotes: 2

Related Questions