JSFiddle - React, Tailwind, and code Playground

by Aleksey Karagodnikov

HTML

<p class="threadNametd"><span>Hello</span>, how are you?</p>
<p class="threadNametd">Me? I'm <span><b>good</b></span>.</p>

JavaScript

var filtered = $('.threadNametd');

filtered.each(function() {
    var there_is_no_b = $(this).find('b').length === 0,    
    html = $(this).html();
    if (there_is_no_b) {
        //Do something
        console.log(html);
    } else {
        console.log(html + ' <-- "b" here');
    }
                    
});