title: How do I escape quotes in HTML attribute values?
body: <p>I'm building up a row to insert in a table using jQuery by creating a html string, i.e.</p>
  
  <pre><code>var row = "";
  row += "&lt;tr&gt;";
  row += "&lt;td&gt;Name&lt;/td&gt;";
  row += "&lt;td&gt;&lt;input value='"+data.name+"'/&gt;&lt;/td&gt;";
  row += "&lt;/tr&gt;";
  </code></pre>
  
  <p><code>data.name</code> is a string returned from an ajax call which could contain any characters.  If it contains a single quote, <code>'</code>, it will break the HTML by defining the end of the attribute value. </p>
  
  <p>How can I ensure that the string is rendered correctly in the browser?</p>