Add a tick mark based on a counter - Javascript String Operation

Javascript examples for String Operation:String Format

Description

Add a tick mark based on a counter

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from   w w  w  .  java  2 s  .  c o m
var count = 5;
function countClicks() {
    count = count + 1;
    var ticks = Array(count+1).join("&#10004;");
    document.getElementById("p2").innerHTML = count+' '+ticks;
}
countClicks();
    }

      </script> 
   </head> 
   <body> 
      <div id="p2"></div>  
   </body>
</html>

Related Tutorials