Nicholas Bjerke Nicholas Bjerke - 10 days ago 6
Javascript Question

"missing ) after argument list error "

I am fairly new to javascript programming and ive been doing this tutorial online.
I am trying make this function to work but i keep getting "missing ) after argument list". Anyone know what i am doing wrong?

$(function() {

$('#main').append("<img src="plus8.png" alt="Click me to see the paragraph!" id="clickMe" />");

$('#clickMe').toggle(function() {
$('#message').show('fast');
$('#clickMe').attr('src', 'minus7.png');


}, function() {
$('#message').hide('slow');
$('#clickMe').attr('src', 'plus8.png');

});

$('message').hide();

});

Answer

the problem is in this line

$('#main').append("<img src="plus8.png" alt="Click me to see the paragraph!" id="clickMe" />");

you cannot nest double quotations inside double quotations, instead mix between double and single quotations for nesting.

$('#main').append('<img src="plus8.png" alt="Click me to see the paragraph!" id="clickMe" />');
Comments