JSFiddle - React, Tailwind, and code Playground
HTML
<g class="node" transform="translate(160.65,400)">
<circle r="10" style="fill: rgb(255,255,255);"></circle>
<text y="18" dy=".35em" text-anchor="middle" style="fill-opacity: 1;">data</text>
</g>
<g class="node" transform="translate(160.65,400)">
<circle r="10" style="fill: rgb(255,255,255);"></circle>
<text y="18" dy=".35em" text-anchor="middle" style="fill-opacity: 1;">ssdata</text>
</g>
JavaScript
var textTag = d3.select(".node text").text();
if (textTag == "data") {
var circleTag = d3.select(".node circle");
console.log(circleTag);
} else {
console.log("Not find");
}