Google Chrome html console format

Is it possible to configure the Google Chrome console to format html output. Therefore if i will

 console.log('<ul><li>1</li><li>2</li></ul>'); 

It will show real instat html markup list

+4
source share
3 answers

No, this is not possible. The Google Chrome API Console link does not mention this.

However, you can create a debugging div tag and add the following to it:

 <div id='debug'></div> 

and

 document.getElementById('debug').innerHTML = '<ul><li>1</li><li>2</li></ul>'; 
+5
source

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) } } 
+1
source

Yes,

you can show the list using

 console.log("hi",[1,2,3,4],"ho"); 

( , important, + converts the array to String.

No, plain html is not possible.

enter image description here

0
source

Source: https://habr.com/ru/post/1492668/


All Articles