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;
    })
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e76771-5da.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e76771-5da.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?