jquery:找到换行符并将其替换为<br>

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

本文关键字:gt lt 替换 br 换行符 jquery      更新时间:2023-09-26

在我的页面中,其中一个表列具有类似的html

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

无论哪里,我都需要用html标签<br> 替换它

如何在Jquery、javascript中做到这一点?

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

X是表名。