title: Add Class Jquery Append + Each
body: <p>i have a problem, i have a while to get information in JSON and i want add an ID on each element but my code doesnt work.</p>
  
  <p>The append work, i have all my result in JSON but the class test doesnt work.</p>
  
  <pre><code>    &lt;style type="text/css"&gt;
        .test
       {
      color:red;
      }
  
   &lt;/style&gt;
   &lt;script&gt;
  
     $(document).ready(function(){
  
     $.ajax({
  
  
          url: 'https://world.openfoodfacts.org/cgi/search.pl?search_terms=&lt;?php echo $_POST['search']; ?&gt;&amp;search_simple=1&amp;action=process&amp;json=1',
          dataType: 'json',
         success: function(json) {
  
  
         var count = 1;
  
           $.each(json.products, function(i, obj) {
  
           window["var" + count] = $('&lt;a href="#null"&gt;' + obj.generic_name_fr + ' - ' + obj.brands + '&lt;/a&gt;'); 
           $("#push").append(window["var" + count]);
           window["var" + count].addClass('test');
  
          count++;
  
  
  
               });
  
  
  
  
          }
  
              }); });
  
  
  
          &lt;/script&gt;
  
          &lt;ul data-role="listview" id="push" style="margin-top:25px;"&gt;
  
                 &lt;/ul&gt;
  </code></pre>
  
  <p>thanks :) </p>