5

I want to use a tab space in my string. I am providing the code of using new line. But I don't know how to use a tab space in a string. Can anyone help me on this !?

"Warning ! Sorry Cash Pay is less than this  <br/> month\'s installment. Please pay the  <br/> right amount."
| improve this question | |
14
0

&#09; is TAB character in ASCII. But according to html spec all white space characters will be stripped to a single character. There are other white space characters too. Like &thinsp;, &emsp; and &ensp; You can try them too.

Update

It seems &emsp; gives a spacing of tab size. See the following

  • a&emsp;b rendered as a b
  • a&ensp;b rendered as a b
  • a&thinsp;b rendered as a b
  • a&nbsp;b rendered as a b
  • a&#09;b rendered as a b
| improve this answer | |
0
0

If you put your string in an HTML <pre> element then it can have a tab character. String "Warning! \t error" set to be put into the innerHTML of <pre id="output"></pre> will result in
:Warning! error.

See also:
https://stackoverflow.com/questions/4631646/how-to-preserve-whitespace-indentation-of-text-enclosed-in-html-pre-tags-exclu

| |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.