jQuery toggle
jQuery toggle is used to provide the toggle functionality between the hide() and show() method.
It hides the shown elements and shows the hidden elements.
Syntax : jQuery toggle
$(selector).toggle(speed,selector);
jQuery toggle Example 1 :
Example
<script type="text/javascript"> $(document).ready(function(){ $("#togglebutton").click(function(){ $(".demo-para").toggle(); }); }); </script> |
jQuery toggle Example 2 :
Example With Speed
<script type="text/javascript"> $(document).ready(function(){ $("#togglebutton").click(function(){ $(".demo-para").toggle(500); }); }); </script> |
Advertisements
Add Comment
📖 Read More
- 1. jQuery Fade In
- 2. jQuery fade Out
- 3. jQuery fade toggle
- 4. jQuery Slide Down
- 5. jQuery Slide Toggle
- 6. jQuery Slide Up
- 7. jQuery Animate
- 8. jQuery Chaining
- 9. jQuery CallBack
- 10. jQuery Traversing