Selecting element w/o selector in js

I knew in js I can select this -> <div id='x'>xd</div> element via document.getElementById('x') or document.querySelector('#x'), but today I discovered i can just select it writing x like it’s a variable in my script already. The question is what is this method called and what is browser support?

3 thoughts on “Selecting element w/o selector in js”

Leave a Comment