Is it possible to make Google Chrome console to format output html
. So if I will
console.log('<ul><li>1</li><li>2</li></ul>');
It will show real list instad of html markup
Is it possible to make Google Chrome console to format output html
. So if I will
console.log('<ul><li>1</li><li>2</li></ul>');
It will show real list instad of html markup
Share Improve this question edited Feb 25, 2015 at 8:16 Adam Pietrasiak asked Jul 22, 2013 at 9:54 Adam PietrasiakAdam Pietrasiak 13.2k10 gold badges81 silver badges96 bronze badges 2-
Note: Dont use
console
in live. – Grim Commented Jul 22, 2013 at 10:21 - Know it, Its debugging purpose. – Adam Pietrasiak Commented Jul 22, 2013 at 14:28
3 Answers
Reset to default 5No, it does not seem possible. The Console API reference for Google Chrome mentions no such thing.
You can however create a debug div
tag and add your contents to that:
<div id='debug'></div>
and
document.getElementById('debug').innerHTML = '<ul><li>1</li><li>2</li></ul>';
A simple hack might be something like this:
console.html = function(data){
var self = this;
for(var i=0; i< arguments.length;i++){
var wrapper= document.createElement('wrapper');
wrapper.innerHTML = arguments[i];
self.log(wrapper)
}
}
Yes,
you can show a list using
console.log("hi",[1,2,3,4],"ho");
(The ,
are important, +
will convert the array into String.
No, plain html is not possible.