JSFiddle - React, Tailwind, and code Playground

HTML

<p>Hello</p>

<p>World</p>

JavaScript

var paragraphs = document.getElementsByTagName('p');

[].slice.call(paragraphs).forEach(function(p) {
    if(p.textContent.indexOf('World') > -1) {
        console.log(p);
    }
});