gtilflm gtilflm - 1 year ago 62
jQuery Question

jQuery: Hide container, then show element in that container

I want to hide a container element with class

. Then I want to show only one element in that container with id

My code...


Problem: The
works fine, but the
isn't actually showing.


Answer Source

Like @ŁukaszTrzewik said. If the parent of an element is hidden calling show() on it won't have any effect.

To fix this, you can do something like this:


This will hide all the child elements of .page_wrapper except #infinite_math_container.



Which will hide all child elements of .page_wrapper and show the child #infinite_math_container after a delay of 200 milliseconds.

Both this example will work only if the #infinite_math_container element is a direct descendent of .page_wrapper.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download