Reputation: 139
I am trying to build a string like this:
"<a><p onclick='showDialog(" + b + ")'>Clicca qui!</p></a>"
However in this way I cannot pass the parameter.
The error is: "Uncaught SyntaxError: missing ) after argument list"
b is a string parameter.
So, how should I alter this?
Thanks!
Upvotes: 1
Views: 54
Reputation: 3367
Your string b
seems to contains parenthesis.
You might want to add some extra quote around your string :
"<a><p onclick='showDialog(\"" + b + "\")'>Clicca qui!</p></a>"
Upvotes: 2