0

If I enter in Textfield some characters including whitespaces, I want to adapt it to the table:

alert(office.contact)

enter image description here

Unfortunate, the line breaks aren't adapted, when field is updated

<td>{!! nl2br(e($Office->contact)) !!}</td>

enter image description here

How can I read out the raw data (incl. Linebreaks) in office.contact?

Expected outcome (office.contact):

<td> Line 1 <br>
     Line 2 <br>
     Line n
</td>

Thank you very much Carlson

Carlson
  • 183
  • 2
  • 11
  • 1
    Line breaks in HTML need to be rendered as the break element `
    `. Alternatively you can render the text inside a `
    ` element which will preserve the whitespace.
    – evolutionxbox Jun 07 '21 at 15:46
  • Does this answer your question? [Line break in HTML with '\n'](https://stackoverflow.com/questions/39325414/line-break-in-html-with-n) – evolutionxbox Jun 07 '21 at 15:47
  • Hi, I want the opposite of preseve. In Alert the text is shown correctly with new Lines (
    ). But as soon I render, new lines are preserved.
    – Carlson Jun 07 '21 at 16:06
  • You need to render the newlines as `
    `. Please check the question linked in my previous comment.
    – evolutionxbox Jun 07 '21 at 16:08
  • See [demo](https://codepen.io/tony19/pen/oNZyPrL) – tony19 Jun 07 '21 at 23:34

0 Answers0