jQuery html()
replace innerhtml of a div
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Replace innerHTML of a Div</title> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#pageTitle").html("<h1>Hello, World!</h1>"); });//from www. ja v a 2s .c o m }); </script> </head> <body> <div id="pageTitle"> <p><b>test.</b><p> </div> <button type="button">Replace HTML</button> </body> </html>