But if I do this, then if it’s an intentional line break - is it not something I’m doing wrong here?
Right now, the reason you got 4 instead of three is here:
<textarea id="post-text" class="form-control" rows="8" placeholder="What's up?" required>
</textarea>
You start the Textarea with a line break in it. So when i paste something onto it, i get 4 lines - the original linebreak, plus (+=
) the lines i pasted.
If you remove that extra line break, the box starts empty, and when you paste into it, you get 3 lines.
Normally whitespace does not matter in HTML - but inside a <textarea>
element, it does - the element’s contents, whitespace and all, is what is inside the box when your textarea is first displayed.
OK, got it. I didn’t realize that you were referring to this line break. Thanks for clarifying.