Creating HTML list using loop in Javascript - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Creating HTML list using loop in Javascript

Demo Code

ResultView the demo in separate window

<!doctype html>
<html>
   <head> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> 
   </head> 
   <body> 
      <div class="result2"></div> 
      <script type="text/javascript">
        var ro = [];/*w w  w  . j  a v a2 s .  c om*/
        for (var j = 0; j <= 49; j++) {
            ro.push(j);
            $('.result2').append(ro[j] + '<br />');
        }
    
      </script>  
   </body>
</html>

Related Tutorials