Here is what is going on - in your ternary operation, on the last line, you are trying to call two functions. That is not possible. You need to use an if block. Here is how I rewrote it. I don't know if you are using the doIt variable for any purpose, but you will want to check for undefined:
$('.holder').on('click','a',function(e){
e.preventDefault();
var $allextended = $(this).closest('.wrapperdoo').find('.extended'),
$extended = $allextended.eq( $(this).index() ),
doIt = undefined;
if ($extended.is(":visible")) {
doIt = $extended.slideUp();
} else {
$allextended.slideUp();
doIt = $extended.slideDown();
}
});
Joseph at SwiftOtter
- 4.3k
- 5
- 39
- 56