If you set ID on html element, you can access it inside your script directly
<!DOCTYPE html>
<html>
<head></head>
<body>
<button id="test">Button</button>
<script>
console.log(test)
</script>
</body>
</html>
The output in the console will be:
<button id="test">Button</button>
It makes the code more complex if you use this functionality of HTML.
© 2023 Vadim Alakhverdov