Bootstrap textarea adds space characters inside a text field

I am using Bootstrap 3 RC1. The problem that I encountered is related to the text field - when the page loads, 3 spaces are added to the texaria, as a result of which the placeholder text is invisible, unless I manually delete the spaces.

How can i stop this?

HTML

<form id="noteSubmitForm"> <fieldset> <textarea id="note-text" rows="6" placeholder="Add a note" class="form-control"> </textarea> <div class="form group"> <button id="noteSubmitButton" type="submit" class="btn btn-success btn-custom"> Save Note </button> </div> </fieldset> </form> 

CSS

 textarea#note-text { width: 625px !important; } 
+6
source share
1 answer

How can i stop this?

Without spaces between the textarea tags, as you have right now:

  <textarea id="note-text" rows="6" placeholder="Add a note" …> </textarea> 

This is a line break (first, a line break at the beginning is ignored by browsers), and then there are spaces before the closing tag, so they are also part of the contents of the value of your text field, because this is how the contents of the text field are written between the open and close labels.

If you do not need content there, do not post content there:

 <textarea …></textarea> 
+7
source

Source: https://habr.com/ru/post/951225/


All Articles