Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <p>Click the button to create a FIGCAPTION element with some text.</p> <button onclick="myFunction()">Try it</button><br><br> <figure id="myFigure"> <img src="/tags/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228"> </figure> <script> function myFunction() { var x = document.createElement("FIGCAPTION"); var t = document.createTextNode("Fig.1 - A view of the pulpit rock in Norway."); x.appendChild(t); var y = document.getElementById("myFigure"); y.appendChild(x); } </script> </body> </html>