Home > Mobile >  How do I make textarea's new line selectable?
How do I make textarea's new line selectable?

Time:12-30

I wonder how can I achieve the same selectable new line as this for <textarea/>.

and this is what the normal textarea looks like image.

I'm currently using react and I tried researching for answer everywhere but I can't find any solution that will work or relavant to the result I'm trying to achieve.

Thanks all

CodePudding user response:

In your stylesheet add:

textarea {
    white-space: pre;
}

This allows new lines to be selected as well.

CodePudding user response:

This is very simple, you can use tag in html and add the below code to css file.

textarea {
white-space: pre;

}

  • Related