tags:

views:

429

answers:

2

I'm trying to append a space using jQuery. Neither of these samples work:

  $("#mySelector").append($(" "));
  $("#mySelector").append($(" "));

Any ideas?

+8  A: 

How about

$("#mySelector").append(" "); // or with & nbsp;
Ólafur Waage
This is the right answer for jQuery, or you could just use CSS: #mySelector { padding-right: 1em; }
fudgey
Thank you, Ólafur. I was trying too hard :)
Joel Harris
A: 

Untested (and probably a bit overkill):

$("").append($("<p> </p>").text());
roosteronacid