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
No, 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.