November 9, 201015 yr Hi all, I would really appreciate if some one helped me with this, I have a table containing multiple rows (tr), each row has two columns (td). In the first column I have a checkbox, when this checkbox is clicked i need it to change the class of a div in the second column of the row. So the table code is like this. <table> <tbody> <tr> <td><input type="checkbox" id="staged" name="slider[staged][]"><td> <td><div id="staged_box" class="hidden">contents of div</div><td> </tr> <tr> <td><input type="checkbox" id="staged" name="slider[staged][]"><td> <td><div id="staged_box" class="hidden">contents of div</div><td> </tr> And the jquery code which i cant get to work is this: jQuery('#staged').click(function() { jQuery(this).parent("tr").find('#staged_box').toggleClass('staged_hidden staged_wrapper'); }); Can some jquery braniac tell me where im going wrong?? Thanks in advance.
November 10, 201015 yr I think you will need to use .parents not .parent as your going up more than one level
Create an account or sign in to comment