JSFiddle - React, Tailwind, and code Playground

HTML

<p><a>hello</a>there</p>

JavaScript

window.onload = function () {
  var para = document.getElementsByTagName("p")[0];

  alert(para.lastChild.textContent);   
}