title: What is the correct way to support apostrophes in javascript when building up html?
body: <p>i have the following code:</p>
  
  <pre><code>var name = "Joe O'Neal";
  
  var row= [];
  row.push(
    "&lt;td&gt;&lt;input type='hidden' name='milestones[" + id + "].Name' 
     value='" + name + "' class='currentRowName'  /&gt;
      &lt;span class='currentRowNameText'&gt;" + name + "&lt;/span&gt;&lt;/td&gt;")
  </code></pre>
  
  <p>but the issue is that i have a situation where there is an apostrophe in the name variable so it causes problems with this:</p>
  
  <pre><code>  value='" + name + "'
  </code></pre>
  
  <p>what is the correct way to write this to avoid any conflicts with apostrophes?  In C#, i would do something like</p>
  
  <pre><code>  value=\"" + name + "\"
  </code></pre>
  
  <p>but that doesn't seem to work in javascript</p>