【发布时间】:2017-04-20 12:18:28
【问题描述】:
当我将数组打印到控制台时,我得到以下符号:“<br>↵”
如何在 JS 数组中用逗号替换“<br>↵”的所有实例?
例如
["767 5th Ave<br>↵New York, NY 10153, USA", "677 5th Ave<br>↵New York, NY 10022, USA"]
到
["767 5th Ave, New York, NY 10153, USA", "677 5th Ave, New York, NY 10022, USA"]
值取自:
<address class="main">
<p>767 5th Ave<br>
New York, NY 10153, USA</p>
</address>
使用以下代码:
$("address.main p:not(:empty)").each(function() {
addresses_google[0].push( $(this).html() );
});
【问题讨论】:
-
所以循环它并对每个索引进行字符串替换
标签: javascript jquery arrays string replace