Getting next closest select element with jquery
<p>I want to get the next select element (because there will be multiple with the same id) and here is the code</p>

<pre><code>function fillProds(catid) {
    $.get("http://localhost/crops/?module=from-receipt&amp;action=getproducts&amp;format=json&amp;catid="+catid , null,function(d){
        CC = eval(d);
        t = $(this).find('select');
        alert(t);
        t.options.length=0;
        t.options[0]=new Option("","");
        for(i=0;i&lt;CC.length;i++) {
            t.options[i+1]=new Option(CC[i].name,CC[i].id);
        }
    });
}
</code></pre>

<p>and for the html part</p>

<pre><code>&lt;tr&gt;
                &lt;td class="first" width="172"&gt;
                    &lt;select onchange="fillProds(this.value)" id="catid"&gt;
                        &lt;option&gt;&lt;/option&gt;
                        &lt;?php foreach ( $cats as $v =&gt; $r ) { ?&gt;
                            &lt;option value="&lt;?=$r['id']?&gt;"&gt;&lt;?=$r['name']?&gt;&lt;/option&gt;';
                        &lt;?php } ?&gt;
                    &lt;/select&gt;
                &lt;td&gt;
                    &lt;input type="hidden" name="transindetid[]" value="" /&gt;
                    &lt;select name="transindet[prodid][]" id="prods" class="validate-not-first"&gt;
                        &lt;option&gt;&lt;/option&gt;
                    &lt;/select&gt;
                &lt;/td&gt;
                &lt;td class="last"&gt;
                    &lt;input type="text" name="transindet[qty][]" class="required" value=""&gt; &amp;nbsp;
                    &lt;a href="#" class="delRow" style="color:red"&gt;x&lt;/a&gt;
                &lt;/td&gt;
&lt;/tr&gt;
</code></pre>

<p>So the issue is I get errors like setting length of undefined probably because I am not getting the select element correctly.
Any correction for the above so that I  can make it work correctly and pick the next select element?</p>

<p>Thank you.</p>
