JSFiddle - React, Tailwind, and code Playground

HTML

<div class="mw-content-ltr">
When<a href="/wiki/Raquel_Ochmonek" title="Raquel Ochmonek"> Raquel Ochmonek</a> comes over to sit 
for <a href="/wiki/Brian_Tanner" title="Brian Tanner">Brian</a>, 
a burglar breaks into the house through the master bedroom 
    where <a href="/wiki/ALF" title="ALF">ALF</a> is hiding. </div>

JavaScript

console.log(".text(): " + $(".mw-content-ltr").text());

$(".mw-content-ltr").contents().each(function(_, row) {
     if ( row.nodeType === 3 && $.trim(row.nodeValue).length ) {
       var textNodeValue = $.trim(row.nodeValue);
       var replaceText = $.trim(row.nodeValue);
       alert(textNodeValue);
    }
});