My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Do anchor tags in HTML have an automatic click listener applied?

TheSheriff's photo
TheSheriff
·Aug 7, 2019

Came across a situation between a <div onclick="javascript:window.location.href='/new-place'"> vs wrapping that element inside a <a href="/new-place"> and wondered if the load on the thread is different from the perspective of does the <a> link have kind of an automatic click listener on it which would effectively make it the same as the <div onclick=""> listener?

As far as I can tell they are basically the same, in terms of listeners but wanted to see if my findings are correct?