0

How to allow multiple line texts for input type=text?

For example, I have text called "my name is krishna and I am new to here"

This is the input text value I want to display in multiple lines.

Like :

myname is krishna </br>
and I am new to here

I have tried

 word-wrap: break-word;
 word-break: break-all;
 white-space: pre-wrap;

Would need some ideas to do this. How can we achieve input type is text wrapping into multiple lines.

Baldráni
  • 5,332
  • 7
  • 51
  • 79
krishna
  • 105
  • 1
  • 3
  • 9

2 Answers2

0

Use a textarea to handle multiple line span

<textarea id="someId" name="someName" cols="20" rows="6"></textarea>

and then jQuery to get the formatting

var htmlCode = $("#someId").html();
Danyal Imran
  • 2,515
  • 13
  • 21
0

I think you should properly look into textarea. Both of them works the same way.

<textarea cols="5" rows="20"></textarea>

It also allows you to control the number of cols and rows of the input

If you are using contactform7, this is the shorthand code to include.

[textarea your-message 40x10 "your message here ..."]

More can be found Here

Tree Nguyen
  • 1,198
  • 1
  • 14
  • 37