6

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");
});
4
  • 4
    You can run the javascript in the console below the document tree pane. If the console is hidden you can click the second button from the left on the lower left corner to display it
    – Esailija
    Jul 13, 2012 at 22:01
  • Just run the script in the Console.
    – Ivan
    Jul 13, 2012 at 22:01
  • @Esailija or just press ESC.
    – elclanrs
    Jul 13, 2012 at 22:03
  • Thanks Esailija! Worked great!!!!!!!!!! Jul 14, 2012 at 0:24

2 Answers 2

6

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");});
1
  • @supercoolville if it worked then you should accept the answer to show your appreciation
    – Saumil
    Apr 8, 2016 at 22:09
-1

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.

3
  • 1
    Actually, you can, and you can even modify the running JavaScript files, even if they won't be saved if you reload the page. Pretty handy for quick tests, imho ;)
    – F.X.
    Jul 13, 2012 at 22:09
  • actually, you can even "just insert HTML code", but the question is not about it, yeah :)
    – madfriend
    Jul 13, 2012 at 22:22
  • since you now know that you can add content please update your answer to avoid confusion for other readers
    – Saumil
    Apr 8, 2016 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.