JSFiddle - React, Tailwind, and code Playground

HTML

<pre id="code_block">
    This is line 1<br>
    This is line 2<br>
    This is line 3<br>
    This is line 4<span id="marker"></span><br>
    This is line 5<br>
    This is line 6<br>
</pre>

JavaScript

var text = $('#marker').map(function(){
    return this.previousSibling.nodeValue;
});

alert(text[0]);