.show() / .hide() / .toggle()
method
Show, hide, or toggle the visibility of elements with optional animation duration.
Syntax
$(selector).show(duration) .hide(duration) .toggle(duration)
Example
javascript
$('#box').hide(); // instant hide
$('#box').show(); // instant show
$('#menu').toggle(); // toggle visibility
// With duration
$('#modal').show(300); // 300ms
$('#alert').hide('slow'); // 600ms
$('#panel').toggle('fast'); // 200ms
// With callback
$('#box').hide(400, function() {
$(this).remove();
});