JSFiddle - React, Tailwind, and code Playground

HTML

<a href="">Empty link</a>
<a>Not a link</a>
<div id="count"></div>

JavaScript

$('#count').text($('a[href=]').length);