I've tried using console.log() but I need to have the developer window open in chrome to see the output.
Alert() writes to the pop-up box.
I want to output to the result window (bottom-right pane) in JSFiddle. Can anyone tell me please?
Updated with a visual of answer by JajaDrinker - thanks for this.

You can open it by right clicking and selecting Inspect Element on that menu or you can use f12 as a shortcut key to open console.
@Rubén yes. The purpose of JSFiddle is to be a web-based javascript IDE. For me, console.
Click on your profile -> dashbord : http://jsfiddle.net/user/dashboard/ then select your saved code. So simple.
Add this to the HTML section:
<div id="console-log"></div>
Add this to the JavaScript section:
var consoleLine = "<p class=\"console-line\"></p>";
console = {
    log: function (text) {
        $("#console-log").append($(consoleLine).html(text));
    }
};
Optionally, add this to the CSS to make it more user friendly:
.console-line
{
    font-family: monospace;
    margin: 2px;
}
You can see an example here.
Here's is an unobtrusive solution, so you won't need to modify your HTML. I used a pre tag, but you can use any tag you want.
console = {
    _createConsole : function() {
        var pre = document.createElement('pre');
        pre.setAttribute('id', 'console');
        document.body.insertBefore(pre, document.body.firstChild);
        return pre;
    },
    log: function (message) {
        var pre = document.getElementById("console") || console._createConsole();
        pre.textContent += ['>', message, '\n'].join(' ');
    }
};
The way I do it is add https://getfirebug.com/firebug-lite-debug.js as an external script.

I created a fork of Pete's version that retains the same sort of unobtrusive functionality but, in addition, stores a copy of the normal console and logs to it as well.
(function() {
    // Store a copy of the old console, but don't junk up the
    // global namespace with it either. This allows console
    // logging in both places.
    var oldConsole = console;
    // Use a pre-existing #console element or create a new one.
    var newConsole = document.getElementById("console") || (function() {
        var pre = document.createElement('pre');
        pre.setAttribute('id', 'console');
        document.body.insertBefore(pre, document.body.firstChild);
        return pre;
    })();
    console = {
        log: function (message) {
            var message = ['>', message, '\n'].join(' ');
            // Log to both consoles...
            oldConsole.log(message);
            newConsole.textContent += message;
        }
    };
})();
console.log("This is an unobtrusive version!");
console.log("Hello World!");
console.log("Test");
console.log("Test");
console.log("Test");
console.log("Test");
console.log("Test");
console.log("Make it scrollable!");
You can see a working version of it here: http://jsfiddle.net/Lanlost/7n6jka2q/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With