How to do a Proper Escape of this Function?
<p>I have a <code>DIV</code> tag generated from jQuery that goes like this:</p>

<pre><code>$('#results')
 .append('&lt;DIV id='
 + A.pid
 + ' onmouseover=function(){google.maps.event.trigger(marker, 'mouseover');};&gt;&lt;H3&gt;'
 + A.name
 + '&lt;/H3&gt;&lt;/DIV&gt;');
</code></pre>

<p>Firebug is giving me an error "<strong>missing ) argument after list</strong>" as it does not recognise the <code>)</code> immediately after <code>'mouseover'</code>.</p>

<p>Doing a <code>\'mouseover\'</code> produces a syntax error upon mouseover of the <code>DIV</code>. The syntax error reads: <strong>function(){google.maps.event.trigger(marker,</strong>
and a look at the generated DIV shows:</p>

<pre><code>&lt;div id="1" 'mouseover');};="" onmouseover="function(){google.maps.event.trigger(marker,"&gt;
</code></pre>

<p>Doing a <code>"mouseover"</code> produces a <strong>blank</strong> document.</p>

<p>How do I do a proper escape for this function?</p>

<p><strong>UPDATE:</strong></p>

<p>This should work:</p>

<pre><code>$('#results')
 .append('&lt;DIV id='
 + A.pid
 + ' onmouseover=\"function(){google.maps.event.trigger(marker, \'mouseover\');};\"&gt;&lt;H3&gt;'
 + A.name
 + '&lt;/H3&gt;&lt;/DIV&gt;');
</code></pre>

<p>I need to put escaped double quotes for the function and escaped single quotes for the argument.</p>
