In an HTML table I want to select some items, I use jQuery in the following manner:
$(document).ready(function()
{
$("input[id*='chkSelectPackage1']").bind("change",function(){
var control=$(this).closest("tr");
var aaaaaaa=control.filter(":nth-child(5)");
});
});
In the HTML table every row has 6 cells, in the 6th cell I have a checkbox and in the selection of this checkbox I want the value inside the 4th cell. How can I do this, I am able to find the closest ‘tr’ but not the children of this ‘tr’
The problem is the use of
filter:It should work if you use
find, and use the correct index (nth-childis 1-indexed):filterlooks at the top-level elements within your jQuery object. In your case, there is only one (thetr), so that won’t work.findlooks at descendants.