Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 26th, 2012  |  syntax: None  |  size: 1.71 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jquery how to select the nth-child of the current TD in a dynamic table
  2. $('.notdupe').live('click', function (e) {
  3.         //alert("indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"));
  4.         $.ajax({
  5.           type: "POST",
  6.           url: "cfc/basic.cfc?method=SetNotDupe",
  7.           data: "indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"),
  8.           error: function (xhr, textStatus, errorThrown) {
  9.             // show error alert(errorThrown);
  10.           }
  11.         });
  12.         alert($(e.target:nth-child(-10)).css);
  13.       });
  14.  
  15. <td class="dupegroup">#dupe_group_number#</td>
  16. <td><input type="checkbox" name="UserIDList" value="#userid#" /></td>
  17. <td><a href="#request.controlURL#individuals/?fa=viewIndiv" target="_blank">#userid</td>
  18. <td>#lastname#</td>
  19. <td>#firstname#</td>
  20. <td>#nickname#</td>
  21. <td>#companyname#</td>
  22. <td>#address1#</td>
  23. <td>#zipcode#</td>
  24. <td>#state#</td>
  25. <td>client</td>    
  26. <td align="center"><input class="notdupe" type="checkbox" name="indivID" value="#userid#" checked /></td>
  27.        
  28. $firstTD = $(this).parent().siblings().first()
  29.        
  30. $(this).closest('tr').find('td:first')
  31.        
  32. $('.notdupe').live('click', function (e) {
  33.         //alert("indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"));
  34.         $.ajax({
  35.           type: "POST",
  36.           url: "cfc/basic.cfc?method=SetNotDupe",
  37.           data: "indivNum=" + $(e.target).val() + "&SetValue=" + $(e.target).is(":checked"),
  38.           error: function (xhr, textStatus, errorThrown) {
  39.             // show error alert(errorThrown);
  40.           }
  41.         });
  42.         alert($(this).closest('tr').find('td:first').text());
  43.       });
  44.        
  45. $td_you_want = $(this).closest('tr').children('td').first();