JSFiddle - React, Tailwind, and code Playground

HTML

<div class="server" id="32">
  <a>Server Name</a>
  <div class="delete-server">X</div>
    <p>Click anywhere, and it works.<br />
        Click on the "x" and it doesn't.</p>
</div>

JavaScript

$(".server").on('click', ':not(.delete-server)', function (e) {
     e.stopPropagation()
     alert('Show dialog!');
});