How would I print something to the result screen in JsFiddle from my JavaScript. I can\'t use document.write()
, it doesn\'t allow it, neither print
document.body.innerHTML = "Your data";
Use the alert()
function:
alert(variable name);
alert("Hello World");
Here's one alternative: http://jsfiddle.net/skibulk/erh7m9og/1/
document.write = function (str) {
document.body.insertAdjacentHTML("beforeend", str);
}
document.write("¡hola mundo");
With ES6 tricks could be
function say(...args)
{
document.querySelector('#out').innerHTML += args.join("</br>");
}
say("hi","john");
Add only
<span id="out"></span>
in HTML
You can do this --->
http://jsfiddle.net/chY5y/
$('body').append(yourVariable);
Now jsfiddle can do it from the scratch. Just go to Javascrpt --> Frameworks & extensions --> Jquery(edge) and check Firebug lite checkbox