document.getElementById("id") works, but $("#id") does not jQuery
<p>I am iterating over some elements and I have found that <code>document.getElementById("id")</code> works, but <code>$("#id")</code> does not.  Why?</p>

<p>Edit: I suppose it wouldn't hurt to post code?</p>

<pre><code>function myFunction() {
    var token, tokens, id, input;
    $("[id^=\"some_id_\"]").each(function() {
        tokens = this.id.split("_");
        id = tokens[tokens.length - 1];
        input = document.getElementById("some_form_element_" + id);  //WORKS
        //input = $("#some_form_element_" + id); //DOESNT, alerts undefined

        alert(input.value);
    });
}
</code></pre>
