JSFiddle - React, Tailwind, and code Playground
by hyperthalamus
HTML
<div id="log"></div>
JavaScript
var log = $("#log"),
logId = 0;
function pad(n) {
n = n + '';
return n.length >= 2 ? n : new Array(2 - n.length + 1).join(0) + n;
}
function nextEntry(id) {
$('<div id="entry' + id + '" class="entry" id=""><input id="cursor" type="text" /></div>')
.appendTo(log)
.bind("change",function() {
var val = $(this).find("input").first().val(),
entry = $("#entry" + id),
date = new Date(),
ts = pad(date.getHours()) + ":" + pad(date.getMinutes()) + ":" + pad(date.getSeconds());
entry.empty().html(ts + " | " + val);
nextEntry(logId);
})
.find("input").first().focus();
logId++;
}
nextEntry(logId);