<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>