Is there a way in javascript to check if an element has a certain attribute value? Given this code:
<div class="wrapper">
<a href=#refresh-cart>view cart</a>
</div>
is there a way to be more specific rather than
document.addEventListener('click', e => {
if (e.target.hasAttribute('href')) {
//...
}
})