user3439075 user3439075 - 3 months ago 18
HTML Question

\t is not working in JavaScript

I am trying to just use a \t between 2 text but the \t tab is not working and no space is given between the 2 text. I tried to just use spacing and that doesn't work too. Anything more than 1 space seems to get trimmed.

I looked around here and most are saying javascript does auto trim thus tab and extra spacing doesn't work. Another is that it is not recognized in certain browsers. I am using Chrome.

Having come across the above replies, I didn't see any solutions. Is there a way around to disable the auto trim? Thanks.


HTML trims whitespace down to 1, not JS. You can change this behavior with CSS. Set white-space: pre for it to respect all whitespace and line breaks in the text.