Normally I select elements with an id via document.getElementById('idName')
. But apparently you can also select them by name only 'idName'. I was not aware of this until recently. I wanted to know if this is a "bad practice" to select elements by their idName? I have already used the search engine and found nothing about select by id name
. So here is my question now.
console.log(idName)
<div id="idName">Hello World</div>