Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to insert javascript into Google Chrome's "Inspect Element"?

If I click "Inspect Element" on a page in Google Chrome, is there a way for me to insert something like this (by clicking Edit HTML) to add a mouseover effect to the "a#link" element on the page?

$("a#link").mouseover(function() {
    $('div.linkcontents').slideDown("slow");
});
like image 509
supercoolville Avatar asked Jul 13 '12 21:07

supercoolville


Video Answer


2 Answers

You don't even need the developer tools, how about just typing it in the browser address bar? Like this:

javascript:$("a#link").mouseover(function(){$('div.linkcontents').slideDown("slow");});
like image 130
Christophe Avatar answered Oct 29 '22 00:10

Christophe


Chrome is not an editor so you can't just insert HTML code. However since javascript is a scripting language you can go to the javascript console under tools in Chrome where you can run javascript code although it will not save it in the website.

like image 28
user1515780 Avatar answered Oct 29 '22 00:10

user1515780