title: Can't generate Javascript from data with parentheses
body: <p>I'm using a PHP/MySQL connection to add a search suggestions feature to my site. It's all working except for one piece. My data all contains parentheses in the values, so when I'm trying to pass the returned data to the input field my onclick function fails! code is as follows:</p>
  
  <pre><code>while ($result = $query-&gt;fetch_object()) {
              echo '&lt;/li&gt;&lt;li onclick="fill(\''.$result-&gt;name.'\');"&gt;'.$result-&gt;name.'&lt;/li&gt;';
          }
  </code></pre>
  
  <p>The list populates from the returned search results, but the query returned looks like this:</p>
  
  <pre><code>&lt;/li&gt;&lt;li onclick="fill('Boire Field&amp;#44; Nashua&amp;#44; NH&amp;#44; US (KASH)');"&gt;
  Boire Field&amp;#44; Nashua&amp;#44; NH&amp;#44; US (KASH)&lt;/li&gt;
  </code></pre>
  
  <p>Firebug gives me the following:</p>
  
  <pre><code>unterminated string literal
      fill('Boire Field, Nashua, NH, US (KASH)
  </code></pre>
  
  <p>The <code>)</code> in the result is prematurely ending the string. How can I escape this out so it will properly call the function?</p>