1

I have a section on which I call toggle() with the callback format. What I have noticed is that if I do a visible check on a child element of the toggled section, that is always the opposite. Instead of visible I get false.

I have the following code fragments:

$('.section_advanced').toggle('fast',resizeSection()); 

function resizeSection() {
    console.log($('#responsibilityLevel').is(':visible'));
    if ($('#responsibilityLevel').is(':visible')) { 
    } else {        
    }
}

where responsibilityLevel is child of of the .section_advanced section.

Pentium10
  • 204,586
  • 122
  • 423
  • 502

1 Answers1

4

You need to pass the resizeSection function instead of calling it.

This:

$('.section_advanced').toggle('fast',resizeSection());

should be:

$('.section_advanced').toggle('fast',resizeSection);
user113716
  • 318,772
  • 63
  • 451
  • 440