# Without using document.getElementById

A few weeks ago I was surprised at at the fact that something that seemed impossible was / is still possible.

I didn't realize that this was even possible in my 20+ years of web development. I even had a debate with my colleague about not using it that way but we weren't in sync.

Apparently - if you set in your HTML `<input type="text" id="first_name" />` , you don't need to do `document.getElementById('first_name').value` - instead, you can directly call `first_name.value` !!!

%[https://codepen.io/anjanesh/pen/GRLJZrj] 

[https://codepen.io/anjanesh/pen/GRLJZrj](https://codepen.io/anjanesh/pen/GRLJZrj)

Apparently, this is still valid and is also in the [HTML spec](https://html.spec.whatwg.org/multipage/nav-history-apis.html#named-access-on-the-window-object).

> the value of the id content attribute for all HTML elements that have a non-empty id content attribute and are in a document tree with window's associated Document as their root.
