title: Splitting text and wrapping each of the words in elements in jQuery
body: <p>PS: Updated Fiddle</p>
  
  <p>Here's a <a href="http://jsfiddle.net/qUUbW/" rel="nofollow">fiddle</a> that wraps text in elements</p>
  
  <p>Here's a <a href="http://jsfiddle.net/qUUbW/70/" rel="nofollow">fiddle</a> trying to split text using commas as delimiters and wrap each of the words in <code>&lt;span class="new"/&gt;</code>. Would anyone please tell me why it gives me <code>Uncaught TypeError: undefined is not a function</code> in the foreach loop? </p>
  
  <p>I want the output to be </p>
  
  <pre><code> &lt;td&gt;
       &lt;span class='new'&gt;Text&lt;/span&gt;
       &lt;span class='new'&gt;that&lt;/span&gt;
       &lt;span class='new'&gt;needs&lt;/span&gt;
       &lt;span class='new'&gt;to&lt;/span&gt;
       &lt;span class='new'&gt;be&lt;/span&gt;
       &lt;span class='new'&gt;wrapped.&lt;/span&gt;
       &lt;span class="count"&gt;not this&lt;/span&gt;
       &lt;button&gt;Wrap&lt;/button&gt;
   &lt;/td&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>$('button').click(function(){
      var wrap_it = $(this).closest('td').contents().eq(0).text();
      wrap_it = wrap_it.split(',');
      console.log(wrap_it);
  
      $.each(wrap_it,function(i,k){
        k.wrap('&lt;span class="new"/&gt;');
      })
  
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;table&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
         &lt;td&gt;Text,that, needs, to, be, wrapped.&lt;span class="count"&gt;not this&lt;/span&gt;&lt;button&gt;Wrap&lt;/button&gt;
      &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Text, that, needs, to, be, wrapped.&lt;span class="count"&gt;not this&lt;/span&gt;&lt;button&gt;Wrap&lt;/button&gt;&lt;/td&gt;
     &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>