how to add delay to hide / show div with pure javascript
<p>I was using jquery script like below for hiding and showing a div with a delay in milliseconds:</p>

<pre><code>function slideonlyone(thechosenone) {
 $('.newboxes2').each(function(index) {
      if ($(this).attr("id") == thechosenone) {
           $(this).slideDown(200);
      }
      else {
           $(this).slideUp(600);
      }
 });
}
</code></pre>

<p>How can i achieve this result in pure javascript? This is the code i have at the moment:</p>

<pre><code> function showonlyone(thechosenone) {
  var newboxes = document.getElementsByTagName("div");
        for(var x=0; x&lt;newboxes.length; x++) {
              name = newboxes[x].getAttribute("class");
              if (name == 'newboxes') {
                    if (newboxes[x].id == thechosenone) {
                    newboxes[x].style.display = 'block';
              }
              else {
                    newboxes[x].style.display = 'none';
              }
        }
  }
}
</code></pre>