How To Solve This "missing ) Argument After List"?
This looks like a trivial question, but I am not sure how to deal with it. I have a DIV tag generated from javascript that goes like this: $('#results') .append('
quote:
var x = "I don't like you!";
var y = 'I don\'t like you!';
var z = 'echo "this text?";';
To implement it on your case, it would be like this:
'<DIVid='
+ A.pid
+ 'onmouseover=function(){google.maps.event.trigger(marker, \'mouseover\');};><H3>'
+ A.name
+ '</H3></DIV>'
Solution 2:
You issue is in the use of the '
character to delimit both the function and the arguments in your call.
Either switch one set of '
out for "
or use \'
around the values of the argument
$('#results')
.append('<DIVid='
+ A.pid
+ 'onmouseover=function(){google.maps.event.trigger(marker, "mouseover");};><H3>'
+ A.name
+ '</H3></DIV>');
//OR
$('#results')
.append('<DIVid='
+ A.pid
+ 'onmouseover=function(){google.maps.event.trigger(marker, \'mouseover\');};><H3>'
+ A.name
+ '</H3></DIV>');
Solution 3:
Try to generate the following string
'<DIVid=' +
A.pid +
'onmouseover=\"google.maps.event.trigger(marker, \'mouseover\');\"><H3>' +
A.name + '</H3></DIV>'
Solution 4:
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.
$('#results')
.append('<DIV id="'
+ A.pid + '"'
+ ' onmouseover="function(){google.maps.event.trigger(marker, \'mouseover\');};"><H3>'
+ A.name
+ '</H3></DIV>');
Solution 5:
Several things
- Stop putting HTML in all caps. This is the 21st century not the 20th century.
- You don't need an anonymous function for the
onmouseover
event. - Wrap attribute values in either single or double quotes (I use double below).
- Read about JavaScript strings and quotes. Here is a tutorial.
Try this
$('#results').append('<divid="' +
A.pid +
'"onmouseover="google.maps.event.trigger(marker, \'mouseover\');"><h3>' +
A.name +
'</h3></div>');
Post a Comment for "How To Solve This "missing ) Argument After List"?"