Patrick Kelly
Posts: 0
Joined: Wed Nov 20, 2013 6:00 am

Extra space added in while putting string into a Label.

I am using Javascript to take the value of three Labels and put them into one Label. It works, but I am getting an extra space that looks terrible.

Here is my code:

var city = Appery("City").text();
var state = Appery("State").text();
var zip = Appery("Zip").text();
Appery("CityStateZip").text(city + ", " + state + " " + zip);

My output should be "City, State Zip". Instead, it is "City , State Zip". I've checked, there is no space in the original text field of the label. If I use an input instead, there's no problem, only if I am retrieving the data from a label. Any idea as to why?

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Extra space added in while putting string into a Label.

not sure how that space creeps in, but there a fix (workaround?)....you can just do this and see the result

Appery("CityStateZip").text(city.trim() + ", " + state + " " + zip);

Patrick Kelly
Posts: 0
Joined: Wed Nov 20, 2013 6:00 am

Extra space added in while putting string into a Label.

Thanks, that works!

Return to “Issues”