What did the <a > tag do after the default event was disabled to achieve the jump?

for example, why can you jump if you disable the default event, and why the a tag e.preventDefault () can also jump? Haven"t default events been banned?

Jun.13,2022

a tag is also dom. You can also add click, and you can use js to jump


<body>
    <a id="btn" href="http://www.baiu.com"></a>
    <script>
        document.getElementById('btn').addEventListener("click", function (e) {
            e.preventDefault();
        })
    </script>
</body>

if you want to adjust after disabling the default event, you can write:

location.href="http://www.baiu.com";

let domArr = document.getElementsByTagName('a');
[...domArr].forEach(item => {
    item.addEventListener('click', function () {
        location.href = this.href;
    })
})
Menu