function to count and add to span but it is not increasing by 1 with each event