JSFiddle - React, Tailwind, and code Playground
HTML
<div id="clock">12:00PM</div>
CSS
.hidden {
visibility:hidden;
}
div {
font-size:30px;
font-weight:bold;
font-family:'courier new'
}
JavaScript
$clock = $("#clock");
$blink = true;
setInterval(function(){
if ($blink) {
$clock.html($clock.html().replace(":",'<span class="hidden">:</span>'));
$blink = false;
}
else {
$clock.html($clock.html().replace('<span class="hidden">:</span>',":"));
$blink = true;
}
}, 1000);