I have a simple bit of jQuery which displays the row below the current one if selected.
What I want if for all the <td> elements but one to fire this method.
Works on whole <tr> row
$(document).ready(function(){
$("#report > tbody > tr.odd").click(function(){
$(this).next("#report tr").fadeToggle(600);
});
});
want to do something like (doesn’t work)
$(document).ready(function(){
$("#report > tbody > tr.odd > td.selected").click(function(){
$(this).next("#report tr").fadeToggle(600);
});
});
You need something like this:
Since you’re clicking a td, need to go up to the row before trying to get the next row. Also this selector should work the same in most cases:
#report td.selected. Since you can’t escape being inside the#reportwith a sibling,#report trcan also be justtrin yournext().