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...

Was it helpful?

Solution

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));

OTHER TIPS

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.

Your jQuery should look like this:

$('element').html('  ');

... where ' ' equals once space.

(with however many spaces you want, of course)

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

Is there a possibility that the code is minified as part of the process of being deployed onto the App Engine?

I would not expect any string of whitespace to be retained as written, perhaps you could actually escape the white space and force any minification to leave it:

example:

element.html('\ \ \ \ \ \ \ \ \ \ \ \ ');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top