问题标签 [ecmascript-4]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
80 浏览

javascript - 如何检查特定字符串是否在innerhtml中?

假设这里有一堆这样的html:

使用 querySelectorAll 获取它们:

然后我想知道 ES4 的每个节点中是否存在字符串“high”。


我尝试了包括()和 indexOf():

但是我得到的所有节点都是真的,而不是 pList[0] 的真和 pList[1] 的假。