I keep getting the error: Uncaught SyntaxError: missing ) after argument list (at bestellen:60:105)
this is my html:
<div class="gerechten">
{% for gerecht in gerechten %}
<div class="Gerechtdiv">
<img src={{gerecht.url}} class="gerechtimg">
<h3 class="GerechtTitel">{{gerecht.gerecht}}</h3>
<p class ="GerechtBeschrijving">{{gerecht.beschrijving}}</p>
<div class ="BottomGerechtDiv">
<p style="font-size: 17px;"><b>€{{gerecht.prijs}}</b></p>
<p>{{gerecht.sterren}}★</p>
</div>
<button class="button" onclick="addItemToCart({{gerecht.gerecht}}, {{gerecht.prijs}})" style="cursor: pointer"><span>Voeg toe aan winkelwagen</span> </button>
</div>
{% endfor %}
</div>
the line the error is referring to is the button line.
i tried clearing the onclick function, then it works, but when i put in the function it gives me an error again
2
Answers
It could be that
{gerecht.prijs}
is missing one pair of{}
. So you should write:The error you get is a Javascript error.
is being evaluated and you will need to find out what the values of
gerecht.gerecht
andgerecht.prijs
is. If your code ends up looking likewhich reproduces your problem:
then the problem is explained. So it all boils down to your template values.