user2040597 user2040597 - 20 days ago 9
jQuery Question

How to see the tab eol spaces in chrome console?

I receive some data after a jQuery

$.get
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

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.

Comments