Reputation: 657
I am trying to use a jQuery selector (this) to get an image nested on the same level. Just a syntax error, any help would be appreciated. Thanks!
$(this).addClass('on');
$(this img).slideUp('fast');
$(this img.accordionButtonActive).slideDown('fast');
Upvotes: 2
Views: 117
Reputation: 32598
$(this img).slideUp('fast');
should be
$(this).find("img").slideUp('fast');
Demo, with working accordion: http://jsfiddle.net/zBrhH/2/
Upvotes: 0
Reputation: 533
I think you want the effect like this:
http://jsfiddle.net/expertCode/zBrhH/
using:
$(this).addClass('on');
$('img', this).slideUp('fast');
$('img.accordionButtonActive', this).slideDown('fast');
I changed some events too. Try it ;)
Upvotes: 1
Reputation: 4622
You can't do $(this img). But you can pass a second parameter which defines the scope, try this:
$('img', this)...
Upvotes: 4