Search code examples
firefoxbrowserconsolefirebuginspector

How do I write directly into the console?


I read an answer to a question on SO and someone suggested writing directly into the console. I thought, that sounds cool let's give it a go. I proceeded to make an attempt, but I couldn't figure it out. How do I write/run code directly in the console? I tried in Firebug & Firefox's inspector and I did a little Google search as well. Did I misunderstand something?


Solution

  • Firebug has two ways to execute some code (and write to the console). These are the Command Line at the bottom of the Console panel:

    Firebug Command Line

    and the Command Editor if you want to write some larger scripts:

    Firebug Command Editor

    which is available by clicking the little arrow at the right side of the Console panel:

    Command Editor toggle button

    The Firefox DevTools have a similar feature to the Command Editor of Firebug called Scratchpad:

    enter image description here

    This tool is available via the Firefox menu > Developer > Scratchpad or by pressing Shift+F4.