JSFiddle - React, Tailwind, and code Playground

HTML

<book>
  The Lord of the Rings
  <author>JRR Tolkien</author>
</book>

JavaScript

$(document).find("book").each(function()
{
    alert($(this).clone().children().remove().end().text());
});