[jQuery] DOM traversal -- need both parent node and siblings
Hello everyone,
I'm currently in a bit of a bind. I have a checkbox that's within a
table cell. I want it so when the input is clicked, the parent table
cell AND its siblings change their classes. I can get to the parent
element, but how would I attach this functionality to its siblings?
Right now, I have:
$(document.forms["Grid"].elements["grid[]"]).toggle(function()
{
$(this).parent().addClass("active");
},
function()
{
$(this).parent().addClass("inactive");
});
(I'm not using toggleClass because I have formatting within the
"inactive" class that's different than some of the other elements)
Would adding something like:
.end().siblings().addClass("active");
To the end of my statements remedy the issue?