Hi,

I'd like some help on this - i have a textarea field, where the user can enter text. The line breaks (\n\r) has to act as real line breaks. So, i've successfully replaced the breaks with the <br /> tag, however, here's the problem - when the user edits these fields again, they appear as <br /> tags in the text field also. How do i nicely replace those tags back in the textarea line break style? Replacing <br /> with \n or \r didn't work.

Thanks

Recommended Answers

All 2 Replies

You have power over edit code right? Do just the opposite, before populating the Textarea, just replace breaks with line breaks

Member Avatar for diafol

Use nl2br to show im html. Don't use it to show in textarea. Simple.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.