On Jan 31, 4:57 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote:
> Hmm. It worked for me. I actually tested it. :) $(this).parent() selects the
> <p> tag. .nextAll() gets all the next elements (forward siblings), then the
> 'div:first' filter finds the first one that's a div. Oh well, Glen's
> solution is fine.
>
> - Richard
Richard, thanks for much for replying back, since you made me realize
I had screwed up (shocker there:), but more importantly I now really
need your solution, because I changed the div structure a bit to the
following, and your solution now works perfectly. (The other one by
Glen was perfect as well for the initial scenario I proposed, but now
since I changed the structure, yours really helps out.)
<div>
<p><input type="checkbox" name="a" value="foo" class="hasHidden"></
p>
<div id="childSec">
//might have other divs inside
</div>
<p><input type="checkbox" name="b" value="foo2"
class="hasHidden"></p>
<div id="childSec">
//might have other divs inside
</div>
<p><input type="checkbox" name="c" value="foo3"
class="hasHidden"></p>
<div id="childSec">
//might have other divs inside
</div>
</div>
$(".hasHidden").click( function () {
$.clearHideStuff( jQuery(this).parent().nextAll("div:first"),
jQuery(this) );
});
(I know I could do the select on the checkbox but this stuff in real
life is dynamic and it applies the class to different types of inputs)
Thanks again.