I am very new to HTML/JS so I appologize if this is a basic question... I tried to look this up on the web and was unable to find a solution.
I am using a JS code to create an HTML. I am trying to set a "value" attribute with a var containing spaces (string with spaces). when inspecting the value in chrome I can see that the string is not set correctly.
This is my JS code:
var templateArray = templateString.split("\t");
for (var i = 0; i < templateArray.length; i++) {
htmlTemplate.push("<option value="+templateArray[i]+">"+templateArray[i]+"</option>");
}
This is the templateArray:
templateArray[0] = template_member_information
templateArray[1] = template - member information
This is what I get when inspecting in chrome:
<option value="template" -="" member="" information="">template - member information</option>
<option value="template_member_information">template_member_information</option>