title: Removing classes from a .html() set variable. Jquery
body: <pre><code>&lt;div&gt;
      &lt;input type="text" placeholder="#" class="error"&gt;
      &lt;input type="text" placeholder="#" class="error"&gt;
  &lt;/div&gt;  
  
  var copylast = $('div').html();
  </code></pre>
  
  <p>I'm trying to copy the DIV but remove the class error from the copylast variable (I need to keep the classes within the original div.)</p>
  
  <p>I've tried a string replace <code>var copylast = copylast.replace('class="error"', '')</code>;
   but it only removes the first instance, plus looks tacky. I'd much rather use <code>removeClass('error')</code> if possible.</p>