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 UL and LI element.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var x = document.createElement("UL"); x.setAttribute("id", "myUL"); document.body.appendChild(x); var y = document.createElement("LI"); var t = document.createTextNode("Tea"); y.appendChild(t); document.getElementById("myUL").appendChild(y); } </script> </body> </html>