Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of jQuery Callback Executed Multiple Times</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <style> h1{ display:none; background:red; padding:20px; } p{ background:yellow; font-size: 24px; padding:20px; } </style> <script> $(document).ready(function(){ $("button").click(function(){ $("h1, p").slideToggle("slow", function(){ alert("The slide toggle effect has completed."); }); }); }); </script> </head> <body> <h1>This is heading</h1> <p>This is paragraph.</p> <button type="button">Click me</button> </body> </html>