Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道那里有一些类似的问题,但我无法成功调整我从类似 问题中看到的代码。
也许最大的不同是我不是在尝试搜索 DOM 中的实际文本节点,而是将字符串存储在一个对象中。我有一个listings对象,我正在使用来自分类列表 API 的数据填充该对象。所以我想获取每个listings[i].body属性,使用正则表达式查找任何电话号码,然后用<a href="tel:x">. 然后,这些相同的数据将用于填充 Google 地图标记和信息窗口。
listings
listings[i].body
<a href="tel:x">