title: Passing parameter as a string containg white spaces in javascript's onclick function
body: <pre><code>"&lt;button onclick=editRecords('" + partId + "')&gt;Add Quantity&lt;/button&gt;";
  </code></pre>
  
  <p>If I pass the <code>partId</code> string without spaces, it's working fine. But if I pass <code>'MRF 01'</code>, it gives me </p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token ILLEGAL.</p>
  </blockquote>
  
  <p>Why is this and how can I fix that?</p>