rwx rwx - 5 months ago 9
CSS Question

Add additonal row to input if text is too long

Question



How can i linebreak the input and add an additional "row" if the value text is too long for the current input width (bootstrap responsiveness).

Current code



<input id="someID" type="text" class="form-control" value="some text that is too long for my input width">


The value is prefilled by a passed django variable (but that doesn't matter).

Example



http://www.bootply.com/Y1IFdLMpig

Answer

Are you looking for a new input field? If that is the case you count the characters passed and add another input field if character count > whatever you define. If you are looking to make the input field multi-line - my understanding is that you need to use a textarea instead.

<textarea>This is where you put the text.</textarea>

You can also look at the following if you want it to be auto-resized: Creating a textarea with auto-resize