title: jQuery, Combine contents of classes and remove old class entries
body: <p>Using jQuery (which I am just learning) I want to take the contents of the product-price class, as well as the product-color class, and combine them with the product-title class contents. I would like these old classes be removed or hidden. It looks like the code works for the first product as I get the result that I want, but not the second product:</p>
  <p>Product 1 ($20, Blue)</p>
  <p>Product 2 (undefined, undefined)</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function()
  {       
      var i = 0;
    console.log(i);
      while( i &lt;= $('.product-title').length)
    {
   
      var value1 = $(".product-price span")[i];
      var value2 = $(".product-color span")[i];
   
      
    $(this).find('.product-title')[i].append(' \(', value1, '\,', value2, '\)')
    /*$(this).find('.product-title')[i].append(value2);*/
   
    i = i + 1;
    console.log(i);
    }   
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="catalog-courses" class="course-listing"&gt;
      &lt;a href="#" title="Title1" class="container"&gt;
        &lt;div class="imgwrap"&gt;
          &lt;div class="ribbon"&gt;
            &lt;span class="ribbon-text"&gt;Sold Out&lt;/span&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="product-image"&gt;
          &lt;img src="https://picsum.photos/100" alt="Product 1" /&gt;
        &lt;/div&gt;
        &lt;div class="product-title"&gt;Product 1&lt;/div&gt;
        &lt;div class="product-description"&gt;This is all about product 1&lt;/div&gt;
        &lt;div class="product-price"&gt;
          &lt;span&gt;$20&lt;/span&gt;
        &lt;/div&gt;
        &lt;div class="product-color product-callout"&gt;
          &lt;span&gt;Blue&lt;/span&gt;
        &lt;/div&gt;
        &lt;div class="product-tags"&gt;
        &lt;span class="product-tag" &gt;
          &lt;span&gt;Tag 1&lt;/span&gt;
        &lt;/span&gt; 
        &lt;span class="product-tag" &gt;
          &lt;span&gt;Tag 2&lt;/span&gt;
        &lt;/span&gt; 
        &lt;span class="product-tag" &gt;
          &lt;span&gt;Tag 3&lt;/span&gt;
        &lt;/span&gt; 
        &lt;/div&gt;
      &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
      &lt;/a&gt; 
          &lt;a href="#" title="Title2" class="container"&gt;
        &lt;div class="imgwrap"&gt;
          &lt;div class="ribbon"&gt;
            &lt;span class="ribbon-text"&gt;Available&lt;/span&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="product-image"&gt;
          &lt;img src="https://picsum.photos/100" alt="Product 2" /&gt;
        &lt;/div&gt;
        &lt;div class="product-title"&gt;Product 2&lt;/div&gt;
        &lt;div class="product-description"&gt;This is all about product 2&lt;/div&gt;
        &lt;div class="product-price"&gt;
          &lt;span&gt;$10&lt;/span&gt;
        &lt;/div&gt;
        &lt;div class="product-color product-callout"&gt;
          &lt;span&gt;Orange&lt;/span&gt;
        &lt;/div&gt;
        &lt;div class="product-tags"&gt;
        &lt;span class="product-tag" &gt;
          &lt;span&gt;Tag 1&lt;/span&gt;
        &lt;/span&gt; 
        &lt;span class="product-tag" &gt;
          &lt;span&gt;Tag 2&lt;/span&gt;
        &lt;/span&gt; 
        &lt;span class="product-tag" &gt;
          &lt;span&gt;Tag 5&lt;/span&gt;
        &lt;/span&gt; 
        &lt;/div&gt;
      &lt;/a&gt;
      &lt;/div&gt;
    &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Can someone point me in the correct direction and also let me know if I am not approaching this in the correct manner? Thank you!</p>