How do I replace all line breaks in a string with <br /> tags?

Jak
Jak
908 Points
132 Posts

How do I replace all line breaks in a string with <br /> tags?

Views: 8818
Total Answered: 1
Total Marked As Answer: 0
Posted On: 24-Feb-2015 15:39

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
4960 Points
31 Posts
         

Hi,

Example:

str = str.replace(/(?:\r\n|\r|\n)/g, '<br />');
Posted On: 24-Feb-2015 15:46
 Log In to Chat