title: Making JQuery .html() wrap attribute values in single quotes
body: <p>JQuery by defaults wraps attribute values in double quotes, it also overrides even if the original html string had single quotes as in this example:</p>
  
  <pre><code>$("&lt;div&gt;&lt;span class= 'foo' id='foo2' &gt;abc&lt;/span&gt;&lt;/div&gt;").html();
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;span class="foo" id="foo2"&gt;abc&lt;/span&gt;
  </code></pre>
  
  <p>I looked up in JQuery documentation, also searched but couldn't find any thing related to this, while I can write a regex replace such as <a href="https://regex101.com/r/cIMDV5/2" rel="nofollow noreferrer">this</a> but I don't want to manipulate HTML with regex for obvious reasons,  <strong><em>I was wondering if there is a profound way of achieving this</em></strong>.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The reason it is bothering me is at some places in the application there exists codes like <code>htmlstring.indexOf("attr='value'")</code> which eventually broke when I did some manipulation in the <code>htmlstring</code> by converting it into JQuery object and back to string.</p>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>I do not need a solution for the particular problem I stated in my upper edit, I already handled that, what made me ask this question was, is it possible or what is the better way of changing the quote wrapping attributes in HTML.</p>