user522401
user522401

Reputation: 91

How to make newline chars visible in HTML textarea?

I want to make newline (CR and LF) characters visible in a textarea field of an HTML form, as you can do in some text editors and IDEs. The user needs to be able to edit the text to insert newlines as well (i.e. create paragraph breaks), which should also show dynamically. Is there a way to do this?

TIA....

Steve

Upvotes: 5

Views: 992

Answers (1)

Oded
Oded

Reputation: 499402

The only way to do this is to print out your own marker characters before/after each line break, using javascript.

The character reference for the pilcrow (¶) character is ¶.

Upvotes: 5

Related Questions