This question has already been answered:
There are several elements with the class .q1, each has a variable "a" with a value of 1. How to make so that when you click on one of the elements with the class .q1, all the other variables "a" change the value to 0. Has it not changed in the pressed?
I tried this: ˅
$('.q1').each(function() { var a = 1; $(this).click(function() { $('.q1').a = 0; }); });
var a =), which is destroyed after the function ends. - user207618