jsquery get all elements contained by a div with given name
<p>So I'll start off by saying I'm completely new to JS and JSQuery. So I'm in the following situation. The page has a structure like:</p>

<pre><code>&lt;div id="id1"&gt;
   &lt;input name="input1" .... &gt;
   .....
&lt;/div&gt;

&lt;div id="id2" disabled="disabled"&gt;
   &lt;input name="input1"  ....&gt;
&lt;/div&gt;

.....
</code></pre>

<p>So the names of the inputs will repeat themselves, only on different divs and only one div will not be disabled at a given moment. I need to be able to get a input element with a given name from a div with a given ID. My approach after reading a bit:</p>

<pre><code>var inputs = $('div[id="' + parent_div +'"] input').filter(function() {
            return (this.hasOwnProperty('name') &amp;&amp; (typeof this.name  != "undefined") &amp;&amp; this.name == component_name);
        });;
for (input in inputs){
   alert(inputs[input]);
   alert(inputs[input].name);           
    } 
</code></pre>

<p>Now I would expect this to return only my given component. However the result is very strange to me as a beginner. The alerts will be return something like the following:</p>

<p>objectHTMLInputElement
component_name             ---- so the first one is the correct one, but after:</p>

<p>1
undefined</p>

<p>object Object
undefined</p>

<p>object HTMLDocument
undefined</p>

<p>div[id="data_modelHR"] input.filter(function () {
                return (this.hasOwnProperty('name') &amp;&amp; (typeof this.name  != "undefined") &amp;&amp; this.name == component_name);
            })
undefined</p>

<p>And this goes on for a while with different functions. Any suggestions?</p>

<p>Regards,
Bogdan</p>
