JSFiddle - React, Tailwind, and code Playground
HTML
<div class="test">This will be deleted</div>
<a href="#" id="test">Delete text</a>
JavaScript
$(function() {
$('a').click(function() {
$('div.' + this.id).remove();
});
});
<div class="test">This will be deleted</div>
<a href="#" id="test">Delete text</a>
$(function() {
$('a').click(function() {
$('div.' + this.id).remove();
});
});