<!DOCTYPE html>
<html>
<body>

<p>Click the button to create an OL element and a LI element.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.createElement("OL");
    x.setAttribute("id", "myOl");
    document.body.appendChild(x);

    var y = document.createElement("LI");
    var t = document.createTextNode("Coffee");
    y.appendChild(t);
    document.getElementById("myOl").appendChild(y);
}
</script>

</body>
</html>