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

Jak
Jak
Member
858 Points
132 Posts

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

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

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 Posts
         

Hi,

Example:

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