JSFiddle - React, Tailwind, and code Playground

HTML

<div id="MainColumn">
<p>Here we have some text inside the p-tag. Then there's <a href="#">link</a>.</p>

<p><a href="#">Nothing but a link inside this p-tag</a></p>
</div>

CSS

div {
    margin: 20px 0;
    color:blue;
}

textarea {
    width: 100%;
}

JavaScript

var $content = $("#MainColumn p:has(a)").filter(function() {
    return $(this).contents().length === 1;
}).children('a').fadeOut(1500);