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.
.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
Post a Comment