Selecting elements within a table with javascript/jquery
<p>I'm trying to select an id inside my table for each row.</p>

<p>This is my table(inspected with browser) at the moment.</p>

<pre><code>&lt;table id="sort"&gt;
            &lt;thead&gt;
                &lt;tr&gt;
                    &lt;th&gt;&lt;/th&gt;
                    &lt;th&gt;&lt;/th&gt;
                    &lt;th&gt;&lt;/th&gt;
                    &lt;th&gt;Pri &lt;/th&gt;
                &lt;/tr&gt;
            &lt;/thead&gt;

                        &lt;tbody style="cursor: n-resize; " class="ui-sortable"&gt;&lt;tr class="priorityRow"&gt;
                            &lt;td id="tableDragSort"&gt;
                                &lt;a class="deleteLink" href="#" rel="17904" title=""&gt;
                                 &lt;img src="/Content/Images/Garage/DeleteButton.png"&gt;&lt;/a&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                                &lt;img id="MainContent_MainColContent_ImageRepeater_CarImg_0" class="17904" src="" style="height:45px;width:60px;"&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                                &lt;input name="ctl00$ctl00$MainContent$MainColContent$ImageRepeater$ctl00$txtText" type="text" value="hjjj" id="MainContent_MainColContent_ImageRepeater_txtText_0"&gt;
                            &lt;/td&gt;
                            &lt;td class="picturePriority"&gt;
                                1
                            &lt;/td&gt;
                        &lt;/tr&gt;&lt;tr class="priorityRow" style="opacity: 1; z-index: 0; "&gt;
                            &lt;td id="tableDragSort" style="width: 22px; "&gt;
                                &lt;a class="deleteLink" href="#" rel="17903" title=""&gt;
                                 &lt;img src="/Content/Images/Garage/DeleteButton.png"&gt;&lt;/a&gt;
                            &lt;/td&gt;
                            &lt;td style="width: 60px; "&gt;
                                &lt;img id="MainContent_MainColContent_ImageRepeater_CarImg_1" class="17903" src="" style="height:45px;width:60px;"&gt;
                            &lt;/td&gt;
                            &lt;td style="width: 153px; "&gt;
                                &lt;input name="ctl00$ctl00$MainContent$MainColContent$ImageRepeater$ctl01$txtText" type="text" value="dd" id="MainContent_MainColContent_ImageRepeater_txtText_1"&gt;
                            &lt;/td&gt;
                            &lt;td class="picturePriority" style="width: 21px; "&gt;
                                2
                            &lt;/td&gt;
                        &lt;/tr&gt;&lt;tr class="priorityRow" style="opacity: 1; z-index: 0; "&gt;
                            &lt;td id="tableDragSort" style="width: 22px; "&gt;
                                &lt;a class="deleteLink" href="#" rel="17895" title=""&gt;
                                 &lt;img src="/Content/Images/Garage/DeleteButton.png"&gt;&lt;/a&gt;
                            &lt;/td&gt;
                            &lt;td style="width: 60px; "&gt;
                                &lt;img id="MainContent_MainColContent_ImageRepeater_CarImg_2" class="17895" src="" style="height:45px;width:60px;"&gt;
                            &lt;/td&gt;
                            &lt;td style="width: 153px; "&gt;
                                &lt;input name="ctl00$ctl00$MainContent$MainColContent$ImageRepeater$ctl02$txtText" type="text" value="wggw" id="MainContent_MainColContent_ImageRepeater_txtText_2"&gt;
                            &lt;/td&gt;
                            &lt;td class="picturePriority" style="width: 21px; "&gt;
                                3
                            &lt;/td&gt;
                        &lt;/tr&gt;
                  &lt;/table&gt;
</code></pre>

<p>The id which here is <code>17904</code>, <code>17903</code> and <code>17895</code> in both <code>&lt;a rel=""&gt;</code> and <code>&lt;img class=""&gt;</code> is the one I want to select into my javascript method which is here:</p>

<pre><code>$("#sort .priorityRow").each(function ()
    {
        var index = $(this).index() + 1;


        var id = /* SELECT ID HERE */

        console.log(id);
        $(this).find(".picturePriority span").text(index);
        SetPicturePriority(id, index);
    });
}
</code></pre>

<p>I don't care which way i select the id really, as long as it works.</p>

<p>Anyone able to help? :)</p>
