I have the following code in my javascript file:
$(document).ready(function(){
$("#shuffle, #game_over_shuffle").bind("click", shuffleBoard);
});
This shuffles some things in a div. Now I also have a scoring system that looks like this:
// Ad score
var score = 0;
You can use a hint, but that will reduce your score (cut from a bigger function):
// Remove 500 points when used
score -= 500;
$('#score').text(score);
This all works, but now I want to reset the score to 0 when the suffle is used. I’ve tried this:
$("#shuffle, #game_over_shuffle").bind("click", shuffleBoard, resetScore);
Note I’ve added resetScore and made a new function to reset the score:
function resetScore(){
score = 0;
$('#score').text(score);
};
But this doesn’t reset the score to 0. What am I missing?
Kind regards,
Maurice
================================
Found a solution myself. Instead of creating a new function, I extended an existing one (using the same bind) setting the score to 0. Thanks to all trying to help me!
Found a solution myself. Instead of creating a new function, I extended an existing one (using the same bind) setting the score to 0. Thanks to all trying to help me!