Check if element is visible or hidden. Hide or show it according to its visibility.
Toggle method:
$('.click').click(function() {
$('.target').toggle();
});
Test code:
Toggle sliding method:
$('.click').click(function() {
$('.target').slideToggle();
});
Test code:
Toggle fading method:
$('.click').click(function() {
$('.target').fadeToggle();
});
Test code:
HTML of examples:
<span class="click">click</span> <div class="target">target</div>