<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>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_ol_create by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:07:52 GMT -->
</html>