Vanilla version of this jQuery
Is there a vanilla javascript version of this jQuery: setInterval(function() { if ($('#cursor').css('visibility') === 'visible') { $('#cursor').css({ visibility: 'hidden' }) } else { $('#cursor').css({ visibility: 'visible' }) } }, 500); I tried this but didn't work: setInterval(function(){ if(cursor.style.visibility="visible"){ cursor.style.visibility="hidden"; } else{ cursor.style.visibility="visible"; } },500); Neither did this one: setInterval(function(){ if(cursor.style.display="block"){ cursor.style.display="none"; } else{ cursor.style.display="block"; } },500); Is it even possible to use pure javascript to get the same blinking effect? Both of my attempts only make it blink once.