Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Effects</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <style>#box{width:100px;height:100px;background:orange;}</style> </head> <body> <button id="toggle">Toggle</button> <div id="box"></div> <script> $("#toggle").click(function(){ $("#box").slideToggle(300); }); </script> </body> </html>
Output