user2461575
user2461575

Reputation: 11

Missing : after property id syntax error

I'm getting a syntax error from the code below:

(function({ 
  var resultsDIV = document.getElementById("results"),
    searchInput = document.forms[0].search,
    currentSearch = ''
  ;

I have tried all sorts of ways of writing this line but continue to get the same error.

The actual error I am getting is:

"Syntax Error: missing : after property id"

Can anyone help?

Upvotes: 1

Views: 176

Answers (2)

Mirko Cianfarani
Mirko Cianfarani

Reputation: 2103

For me miss ; or you not declared the id in one tag.

Example:

<p id="po"></p>

After with the update's question:

(function(){

var resultsDIV = document.getElementById("results");
    searchInput = document.forms[0].search;
    currentSearch = '';
})();

Upvotes: 0

Blender
Blender

Reputation: 298246

(function({ should be (function(){.

Upvotes: 1

Related Questions