Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> <style> #div { padding: 20px; font-size: 20px; border-radius: 5px; color: red; background-color: yellow; } </style> </head> <body> <div class="alert" id="div"> Welcome to <strong>W3Docs.</strong> </div> <script> let div2 = div.cloneNode(true); // clone the message div2.querySelector('strong').innerHTML = 'Javascript book.'; // change the clone div.after(div2); // show the clone after the existing div </script> </body> </html>