davidkelleher davidkelleher - 1 year ago 97
Javascript Question

How can I output results to the 'result' window in JSFiddle?

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.

enter image description here

Answer Source

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) {

Optionally, add this to the CSS to make it more user friendly:

    font-family: monospace;
    margin: 2px;

You can see an example here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download