getElementById returns an object instead of an element
<p>I have an input with an id of <code>name</code>:</p>

<pre><code>&lt;input type="text" id="name"&gt;
</code></pre>

<p>When I run <code>document.getElementById("name")</code> in the console, I get the element itself (<code>&lt;input type="text" id="name"&gt;</code>), but as soon as I assign it to a variable (<code>var name = document.getElementById("name");</code>), I get the string <code>"[object HTMLInputElement]"</code>.</p>

<p>Why does that happen? Why can't I just get the selected input element, instead of the input element object?</p>

<p>Thanks.</p>