Skip to main content

Convert this jQuery to Vanilla JavaScript [duplicate]

Guys kindly help me convert jQuery to JavaScript

<script>
  var count = 1;
  if(jQuery('.post-content h2').length > 0)
  {
    jQuery('.post-content h2').each(function(){
      jQuery(this).prepend( '<span class="head-count">'+count+'</span>' );
      count++;
    });
  }
</script>
Via Active questions tagged javascript - Stack Overflow https://ift.tt/JBvZEp8

Comments