NeoSpoon
NeoSpoon

Reputation: 1

Getting "SyntaxError: missing ) after argument list"

Im trying to use document.write in order to create a html element that will link to a function. However I am getting:

SyntaxError: missing ) after argument list"

The document.write is also inside a for loop as it needs to dynamically create links for each piece of data.

standardArray[i] = '<a href ="javascript:void(0);" onclick = "showDetails(null, null, ' + stdata.rows.item(i).Title + ');">' + stdata.rows.item(i).StandardNumber + ' ' + stdata.rows.item(i).Title;
document.write(standardArray[i]);

Any ideas?

Upvotes: 0

Views: 68

Answers (1)

Martin
Martin

Reputation: 475

I assume CORNEAL CALCIUM CHELATION is a string, so you need to format your onclick as follows:

showDetails(null, null, 'CORNEAL CALCIUM CHELATION');

Upvotes: 1

Related Questions