Question: I want to collect every id of `div` that has been clicked then assign that value to a `var`. 

Here is my code:

```
$('div.kim2bb').on('click', function(){
    var el = el + ', ' + $(this).attr('id');
    alert(el);
});

```

I tried this one, but every time I click `el` it's reset, how can I prevent it from resetting?

Answer: 
Move the initial declaration of `el` outside of your click event:

```
var el = '';
$('div.kim2bb').on('click', function(){
    el += ', ' + $(this).attr('id');
    alert(el);
});

```

This causes the variable to live in another scope.

And you should use arrays instead:

```
var el = [];
$('div.kim2bb').on('click', function(){
    el.push( $(this).attr('id') );
    alert(el.join(", "));
});

```
Keep it in an array. Makes it easier to use later. (My opinion)

```
el=[];
$('div.kim2bb').on('click', function(){
    el.push($(this).attr('id'));
    console.log(el);
});

```