safari and chrome javascript console multiline
JavascriptBrowserDebuggingJavascript Problem Overview
Firebug has a multiline feature in their console tool. Is there a way to get this functionality with the debugger tool in Safari/Chrome?
Javascript Solutions
Solution 1 - Javascript
Shift-Enter on Windows allows multi-line entry where Option-Enter works on Mac.
A more fully featured editor is in the works.
Solution 2 - Javascript
For Google Chrome
, you can Sources >> Snippets >> + New Snippet
in the Developer Console
.
Once you have written your multi-line code
, you can execute it with the button
or with Ctrl + Enter
as mentioned on the button
.
This is like a text-editor which has a host of keyboard shortcuts
which you can find under Settings >> Shortcuts
under Text Editor
Good Luck.
Solution 3 - Javascript
I recommend this:
- Write
debugger;
and hit Enter, in the console tab - This takes you to the Sources tab; if not, make sure debugger breakpoints are active
- Now you can write whatever you want in the Sources tab, which acts like a full IDE with features like newline and indentation
- Select any part of your code to run, and right-click, choose
Evaluate in console
Solution 4 - Javascript
http://code.google.com/p/chromium/issues/detail?id=35487
Not yet.
UPDATE: the status of the issue I linked to is now "fixed".
Solution 5 - Javascript
Try pressing option (shift on Windows) at the same time as return. Inserts a newline on Mac.
Solution 6 - Javascript
Shift + Enter seems to work in chrome browser. I am using ubuntu 12.04 as my operating system. Thanks to Mr Bester and Sam Dutton for their inputs.
Solution 7 - Javascript
It is simple ... place semicolons between your multilines and it will work in the console.
For example
if you have html like this
<div id="test">This is a test statement</div>
You could paste following in the console and it will work
var ourTest = document.getElementById('test'); alert(ourTest.innerHTML);
I hope it helped.
Solution 8 - Javascript
There is cool extension to chrome https://chrome.google.com/webstore/detail/bigconsole/klommbdmeefgobphaflhmnieheipjajm
It just add another tab named BigConsole and it allow multiline code execution
Solution 9 - Javascript
Try using the notepad (or someting else) and then copy/paste to the console, works for me!!!!