How do I get line breaks in my template to show in the textarea?
I am trying to add a line break in each template after the ,
and can't use </ br>
either I think due to using.value
.
I tried JavaScript: How to add line breaks to an HTML textarea? and javascript | save textarea value with line breaks as well as a suggestion to use style="white-space:pre-wrap"
.
var template_Birthday = "Hey <NAME>, This is the Birthday Template.";
var template_NewJob = "Hey <NAME>, This is the New Job Template.";
var content = function() {
var e = document.getElementById("template");
var strUser = e.options[e.selectedIndex].value;
if (strUser === "template_NewJob") {
messageBodyTextarea.value = template_NewJob;
} else if (strUser === "template_Birthday") {
messageBodyTextarea.value = template_Birthday;
}
};
<textarea class="form-control" rows="7" name="message" id="messageBodyTextarea"></textarea>