JSFiddle - React, Tailwind, and code Playground

by domenlightenment

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<ul>
    <li>2</li>
    <li>3</li>
</ul>

JavaScript

//create a text node and li element node and append the text to the li
var textNode = document.createTextNode('1');
var elementNode = document.createElement('li');
elementNode.appendChild(textNode);

//select the ul in the document
var ulInDoc = document.getElementsByTagName('ul')[0]

//add the li element we created to the DOM
ulInDoc.insertBefore(elementNode,ulInDoc.firstChild);

console.log(document.body.innerHTML);