title: How do I escape only single quotes?
body: <p>I am writing some JavaScript code that uses a string rendered with PHP. How can I escape single quotes (and only single quotes) in my PHP string?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('#myElement').html('say hello to &lt;?php echo $mystringWithSingleQuotes ?&gt;');
  &lt;/script&gt;
  </code></pre>