user2040597 user2040597 - 1 year ago 80
jQuery Question

How to see the tab eol spaces in chrome console?

I receive some data after a jQuery

and I would like to be able to see all the non visible characters like spaces, tabs, end of line or new line. Is it possible to see this in chrome console? How?

Answer Source

One way would be to a manual replace for all possible whitespace characters:

var html = '\n\t';
console.log(html); // displays whitespace
console.log(html.replace(/\n/g,'\\n').replace(/\t/,'\\t')); // displays '\n\t'

Quite tedious, I know.

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