<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Removing the Contents of the Elements in jQuery</title> <style> .container{ padding: 16px; background: skyblue; border: 5px solid green; } </style> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ // Empty container div on button click $("button").click(function(){ $(".container").empty(); }); }); </script> </head> <body> <div class="container"> <h1>Happy Morning!</h1> <p ><strong>Note:</strong>If the button below is clicked, it will delete all the content within the container div, including the button itself.</p> <button type="button">Empty Container</button> </div> </body> </html>