.html() jQuery method bizzare bug - resolves to empty space locally, but not on production

Question!

I'm making a simple jquery command:

element.html("                 ");

using the attributes/html method: http://docs.jquery.com/Attributes/html

It works on my local app engine server, but it doesn't work once i push to the google server. The element empties, but doesn't fill with spaces.

So instead of " " (6 spaces) it's just "".

Once again, this is running on App Engine, but I don't think that should matter...

By : jamtoday


Answers

You could try generating the space during run-time, so it won't be trimmed or whatever happens during transport:

element.html(String.fromCharCode(32));
By : davil


Have you tried using   instead of spaces? The html() method just pumps the string into the innerHTML of the element(s).

By : Sugendran


This might not be a direct answer to your problem, but why are you even wanting to put in a heap of spaces? You can probably achieve the same result by just changing the padding-left or text-indent of that element.

element.css("textIndent", "3em");

Using a heap of  s is a very dodgy way to do indentation.

By : nickf


This video can help you solving your question :)
By: admin