jquery :Find the new line character and replace it with <br>

In my page one of the table column has the html like below

My world Logistics,\n Hamburg Industriestrasse \n 21107 Megas Sorter HH India

wherever there is \n i need to replace it withe html tag <br>

How can do it in Jquery, javascript?


var messagetoSend = document.getElementById('x').value.replace(/\n/g, "<br />");

X is the table name.

Need Your Help

Rails. Errors in view

ruby-on-rails devise

I have the PostController, which i use decent_exposure gem.

Phone number doesn't get validated javascript

javascript forms

I'm making a form and my validation function works, but completely ignores the phone number and allows it to be sent.