Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of jQuery Toggle Effect</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <style> p{ padding: 15px; background: #F0E68C; } </style> <script> $(document).ready(function(){ // Toggles paragraphs display $(".toggle-btn").click(function(){ $("p").toggle(); }); }); </script> </head> <body> <button type="button" class="toggle-btn">Toggle Paragraphs</button> <p>This is a paragraph.</p> <p>This is another paragraph.</p> </body> </html>