jquery – some frequent questions

1) How do I test if an element exists?
if ( $( “#myDiv” ).length ) {
$( “#myDiv” ).show();
}

2) How do I determine the state of a toggled element?

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

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

3)

Leave a Reply