Javascript examples for jQuery:Number
For loop from 0 to n number with digits specification
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> $(window).load(function(){// w ww .j av a 2 s . co m var str = ''; var zeros = '0123456789000000'; for(i=0;i<11;i++){ var temp = zeros.slice(i.toString().length); str += temp+i+'<br>'; } $("#TestDiv").append(str); }); </script> </head> <body> <div id="TestDiv"></div> </body> </html>