How do you hide and show an element in jQuery?
<div id="box">Box</div>
$('#box').hide();
console.log($('#box').css('display'));
$('#box').show();
console.log($('#box').css('display'));
$('#box').toggle();
console.log($('#box').css('display'));
Console output
none
block
none
See jQuery Effects.
Learn more about the similar topics:
| Tutorials |
|---|
| jQuery Effects: hide, show and toggle |
| jQuery Fade and Slide Effects |
| jQuery animate() Method |
| jQuery Method Chaining and Callbacks |
| Exercises & Assignments |
|---|
| Write jQuery code to show and hide a panel with one button |
| Write jQuery code to make a simple accordion |
| Write jQuery code to make simple tabs |