whitespace - jquery. get text() to preserve blanks/spaces -


how jquery text() preserve blanks? want

 $("#ele").text("a     a"); 

to show spaces in between.

i have created jsfiddle illustrate problem.

http://jsfiddle.net/zx4x9/

.html() works, i'd have convert other entities first ( <, >, " etc.). and, seems text() should able this.

the problem not .text(). if want consecutive , other stray spaces show up, can use white-space: pre <li>s:

ul li {     white-space: pre; } 

see this


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -