Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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>
<br>
How can do it in Jquery, javascript?
replace()
<script> var messagetoSend = document.getElementById('x').value.replace(/\n/g, "<br />"); alert(messagetoSend); </script>
X is the table name.
Add a comment
var messagetoSend = document.getElementById('x').innerHTML.replace(/\\n/g, "<br />");
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
replace()method?