for each array item and create <LI> - Javascript jQuery

Javascript examples for jQuery:Array

Description

for each array item and create <LI>

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
  <script>
       $(function() {/* www .  j ava 2  s  .  com*/
          var data = ['Gmail', 'Docs', 'Android'];
          var products = $('#products');
          $(data).each(function(index, value) {
             products.append('<li>' + value + '</li>');
          });
       });
    
      </script> 
 </head> 
 <body>
   My favorite Google products: 
  <ul id="products"></ul>  
 </body>
</html>

Related Tutorials