JSFiddle - React, Tailwind, and code Playground

HTML

<div id='hello'>hello</div>
<a class="title" href="#">this example</a> is a test

JavaScript

$(function() {
    // Accept the event arg ----v
    $('a.title').click(function(e) {
        // Stop propagation
        e.stopPropagation();
        var htmlClickBind = function (e) {
            console.log('clicked on html, e.target = ' + e.target);
            console.log(e.target == '');
            if (!$(e.target).is('a') ) {
                console.log('cleared click event');
            }
            else {
                $('html').one('click', htmlClickBind);
            }
        };
    
        $('html').one('click', htmlClickBind);
    });
});