+ 2

Unexpected token error

$(document).ready(function(){ var score = 0; $('.btn').click({ score++; $('#nu').text(score); }); }); why is this not working ??

11th Mar 2018, 9:23 AM
Siddhant Singh
Siddhant Singh - avatar
2 Answers
+ 17
$(document).ready(function(){ var score = 0; $('.btn').click(function(){ score++; $('#nu').text(score); }); }); //missed function() inside click({...})
11th Mar 2018, 9:56 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
@ValentinHacker Thank You
11th Mar 2018, 10:03 AM
Siddhant Singh
Siddhant Singh - avatar