JSFiddle - React, Tailwind, and code Playground

by overlord_tm

HTML

<ul id="list">
  <li>
    <a href="www.google.it">link</a>
  </li>
</ul>
<button id="add">Add link</button>

JavaScript

window.onload = init;

function init() {
  document.getElementById('add').onclick = add;
}

function add() {
  var el = document.getElementById("list");
  var node = document.createElement("li");
  var link = document.createElement("a");
  link.innerText = "Link Text"
  link.setAttribute('href', 'http://www.google.it');
  node.appendChild(link);
  el.appendChild(node);
}