Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Set HTML Contents of the Element</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("body").html("<p>Hello World!</p>"); }); }); </script> </head> <body> <button type="button">Write Message</button> </body> </html>