A
A
andreyka_g2015-03-23 15:03:38
JavaScript
andreyka_g, 2015-03-23 15:03:38

How to make one counter for different elements?

Hello! I have two blocks and there is one counter for them, but how can I make the counter count only for clicks of one element and start counting from 0 when clicking on another? I understand that you can add several counters, but as for me, this is not the best option, setting 40 variables is somehow not right.
This is what the example looks like now:
jsfiddle.net/pnq2qtfj/1
I hope I explained it clearly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-03-23
@andreyka_g

jsfiddle.net/pnq2qtfj/7
or
jsfiddle.net/pnq2qtfj/10
or
jsfiddle.net/pnq2qtfj/11

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question