I have a DIV tag generated from jQuery that goes like this:
$('#results')
.append('<DIV id='
+ A.pid
+ ' onmouseover=function(){google.maps.event.trigger(marker, 'mouseover');};><H3>'
+ A.name
+ '</H3></DIV>');
Firebug is giving me an error “missing ) argument after list” as it does not recognise the ) immediately after 'mouseover'.
Doing a \'mouseover\' produces a syntax error upon mouseover of the DIV. The syntax error reads: function(){google.maps.event.trigger(marker,
and a look at the generated DIV shows:
<div id="1" 'mouseover');};="" onmouseover="function(){google.maps.event.trigger(marker,">
Doing a "mouseover" produces a blank document.
How do I do a proper escape for this function?
UPDATE:
This should work:
$('#results')
.append('<DIV id='
+ A.pid
+ ' onmouseover=\"function(){google.maps.event.trigger(marker, \'mouseover\');};\"><H3>'
+ A.name
+ '</H3></DIV>');
I need to put escaped double quotes for the function and escaped single quotes for the argument.
You need to put ” around the values of your html attributes. Otherwise the browser thinks the attribute ends at the next whitespace and that is exactly right after the
(marker,part.