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 -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -