Jquery: Select a row in a Table and use its data?
<p>I have a table where i want to be to both select a row and delete a row, but i can't figur out how to do this with JQuery. The code i have only effects the first row in the table. So i can remove the first row but no other. What is wrong. Here is what i tried:</p>

<pre><code>&lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
&lt;script type="text/javascript" language="javascript"&gt;
    $(document).ready(function() {
        $("#newCandidatesTable").tablesorter();
        var candidateID = $("#candidateID").text();

        // Event actions
        $("#acceptCandidateButton_" + candidateID).click(function(e) {
            $.post("/Admin/AcceptCandidate/", { candidateID: $("#candidateID").text() }, completeAccept());
        });

        // Functions
        function completeAccept() {
            showMsgBox($("#candidateName").text() + " er blevet accepteret, som ansøger til stillingen: ...");
            $("#tr_" + candidateID).remove();
        }

        function getFirstNameFromFullName(fullName) {
            var nameArray = new Array();

            nameArray = fullName.toString().split(" ");

            return nameArray[0];
        }
    });
&lt;/script&gt;
&lt;h2&gt;Nye ansøgere&lt;/h2&gt;
&lt;table id="newCandidatesTable"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th style="cursor: pointer;"&gt;ID&lt;/th&gt;
            &lt;th style="cursor: pointer;"&gt;Navn&lt;/th&gt;
            &lt;th style="cursor: pointer;"&gt;Email&lt;/th&gt;
            &lt;th&gt;&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
&lt;% foreach (var candidate in Model)
{
  %&gt;
     &lt;tr id="&lt;%= "tr_" + candidate.iAnsogerID %&gt;"&gt;
         &lt;td&gt;&lt;div id="candidateID"&gt;&lt;%= candidate.iAnsogerID %&gt;&lt;/div&gt;&lt;/td&gt;
         &lt;td&gt;&lt;div id="candidateName"&gt;&lt;%= candidate.vNavn %&gt;&lt;/div&gt;&lt;/td&gt;
         &lt;td&gt;&lt;div id="candidateEmail"&gt;&lt;%= candidate.vEmail %&gt;&lt;/div&gt;&lt;/td&gt;
         &lt;td&gt;
             &lt;div id="&lt;%= "acceptCandidateButton_" + candidate.iAnsogerID %&gt;" style="cursor: pointer; border: 1px solid black; width: 150px; text-align: center;"&gt;Godkend&lt;/div&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
  &lt;%
} %&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p></p>
