Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (14 sloc) 510 Bytes
<script>{ "title": "How do I determine the state of a toggled element?" }</script>

You can determine whether an element is collapsed or not by using the :visible and :hidden selectors.

var isVisible = $( "#myDiv" ).is( ":visible" );

var isHidden = $( "#myDiv" ).is( ":hidden" );

If you're simply acting on an element based on its visibility, just include :visible or :hidden in the selector expression. For example:

$( "#myDiv:visible" ).animate({

	left: "+=200px"

}, "slow" );
You can’t perform that action at this time.