I am trying to enable manual line breaks in <td> tag in HTML.
Content is coming from a file which consists of ENTER or manual line breaks, but while displaying this data in HTML table, data is being displayed continuously. Means it is ignoring manual line breaks.
Is there any way to make <td> tag to consider manual line breaks or ENTER you can say?
For example:
Text coming from DataBase:
Line 1.
Line 2.
Line 3.
(with ENTER after each line)
Data displayed in table cell:
Line 1.Line 2.Line 3.
(not considering ENTER after each line)
Tried different ways but failed. Please suggest some solution.
Please try this
str = str.replace(/(?:\r\n|\r|\n)/g, '<br />');
this will covert all enter key pressed to line break
OR
You can use 'pre' tag.
Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With