JSFiddle - React, Tailwind, and code Playground

by Avinash_R

HTML

<div>
    <i>this is crappy data</i>
    <img src="/../img/logo.png" style="background: rgb(61, 106, 162);" />XXXXXX
    <br />etc etc <b>and more html</b>

</div>

JavaScript

var childNodes = document.querySelector("div").childNodes, pickNext = false;
for(var i in childNodes) {
    var childNode = childNodes[i];
    if(pickNext) {
        alert(childNode.nodeValue);
        break;
    }
    // same as $(childNode).is("img")
    // now you can put the XXXXXX where ever you want.
    // as far as you know which is the next sibling.you can get it
    if(childNode.nodeName === "IMG") {
        pickNext = true;
    }
}