Why does the following code change all of the TDs in the table with the class=dupegroup red? The TD that fires the click event has a checkbox in it. I want to know the value of the first TD in the row so I put a class=dupegroup on it. The ajax call updates the database. This is just a test so I could figure out a way to get the value of the first TD.
$('.notdupe').live('click', function (e) {
$.ajax({
type: "POST",
url: "cfc/basic.cfc?method=SetNotDupe",
data: "indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"),
error: function (xhr, textStatus, errorThrown) {
}
});
$('td').prev('.dupegroup').css('background-color', 'red');
});
adding HTML from comment…
<td class="dupegroup">#dupe_group_number#</td>
<td>
<input type="checkbox" name="UserIDList" value="#userid#"/>
</td>
<td>
<a href="#request.controlURL#individuals/?fa=viewIndiv&dkey=#userid#" target="_blank">
#userid#
</td>
<td>#lastname#</td>
<td>#firstname#</td>
<td>#nickname#</td>
<td>#companyname#</td>
<td>#address1#</td>
<td>#zipcode#</td>
<td>#state#</td>
<td align="center">
<input class="notdupe" type="checkbox" name="indivID" value="#userid#" checked />
</td>
As @am not i am said should work but if you already have a unique way to grab it…why not just write it like this