Skip to main content

console.log() with jsFiddle


        jsFiddle is a great tool for quick JavaScript prototyping.

jsFiddle is a great tool for quick JavaScript prototyping. While it’s possible to use your browser’s console log to preview bits and pieces of output, I was looking for a cleaner way to do this, using just the jsFiddle panes. I’ve come up with a simple way to add a logging facility to the Result pane if you are using jQuery.

You can either start with my Fiddle directly here or add the following to your Fiddle:

<div id="console-log">&nbsp;</div>
console = {
    log: function (text) {
        $("#console-log").append($(consoleLine).html(text));
    }
};
.console-line
{
    font-family: monospace;
    margin: 2px;
}