title: How to loop through elements created in jQuery to get their text value?
body: <p>I want to loop through div created in jQuery that have the class &quot;hour&quot; to find the text held within each.</p>
  <pre><code>$(document).ready(function(){
      var hours = [&quot;8am&quot;, &quot;9am&quot;, &quot;10am&quot;, &quot;11am&quot;, &quot;12pm&quot;, &quot;1pm&quot;, &quot;2pm&quot;, &quot;3pm&quot;, &quot;4pm&quot;, &quot;5pm&quot;];
  
      for (i = 0; i &lt; hours.length; i++){
          //create main row div that holds everything
          var timeSlot = $(&quot;&lt;div&gt;&quot;);
          timeSlot.addClass(&quot;row time-block&quot;);
          //creates block on left that holds the time
          var leftBlock = $(&quot;&lt;div&gt;&quot;);
          leftBlock.addClass(&quot;hour col-md-2&quot;);
          leftBlock.text(hours[i]);
          timeSlot.append(leftBlock);
          //creates the text input area in the middle
          var middleBlock = $(&quot;&lt;textarea&gt;&quot;);
          middleBlock.addClass(&quot;col-md-9 description&quot;);
          $(timeSlot).append(middleBlock);
          //Creates save button
          var btn = $(&quot;&lt;button&gt;&quot;);
          btn.addClass(&quot;saveBtn col-md-1&quot;);
          $(timeSlot).append(btn);
          //crates the floppy disc icon
          var floppy = $(&quot;&lt;img&gt;&quot;);
          floppy.addClass(&quot;floppy&quot;);
          floppy.attr(&quot;src&quot;, &quot;assets/save.png&quot;)
          floppy.attr(&quot;alt&quot;, &quot;icon of floppy disc&quot;);
          $(btn).append(floppy);
          
          //appending everything to the container
          $(&quot;#container&quot;).append(timeSlot); 
      }
  })
  
  </code></pre>
  <p>I tried using the .each() and the console log returns nothing although it will work on other elements on the html page that were not created dynamically. I can't seem to find any answers specifically to do with looking through objects created in jQuery.</p>
  <pre><code>$('.hour').each(function(){
      console.log($(this).text());
  });
  </code></pre>
  <p>Any suggestions of what to try would be appreciated, I'm new to this!</p>