Simple error yet very annoying appendTo

javascript, jquery, syntax

Solution

You need to remove the `;` after the `option` is created:

s.append(
    $('<option data-town="' + value.town + '" data-street="' + value.street + '" data-town="' + value.town + '" data-number="' + value.number + '"></option>').val(valueVar).html(textString) // <- no ; here
);

Problem

I've basically got this error ``` Uncaught SyntaxError: Unexpected token } ``` Which is this line ``` s.append( ); } <-- this is the syntax error ``` Here's the full jQuery in which I'm trying to perform ``` var s = $('<select id="addressList" class="txt" style="width:150px;letter-spacing: 0px;"/><input type="button" class="submit" id="chooseAddress" value="Submit"><br/><br/>'); var items = []; $.each(data, function(key, value) { if(val.address != undefined) { var textString = value.address; var valueVar = value.address; s.append( $('<option data-town="' + value.town + '" data-street="' + value.street + '" data-town="' + value.town + '" data-number="' + value.number + '"></option>').val(valueVar).html(textString); ); } }); ``` I'm sorry for posting such basic, but It's literally been mind boggling me for how long

Original source