Question: I have this code

```
<div></div>
<form>
<input type="text" name="abc">
<input type="submit" value="send">
</form>

$('form').on('submit', function(){
   $.post('process.php', $(this).serialize(), function(data) {
    $('div').html(data);
   });
   return false;
});

```

Everything works but after submit value that I filled into input is gone and it's empty..Where can be problem?

Answer: 
You can create a static array and store it on your constructor function:

```
MyClass.allInstances = [];
MyClass.allInstances.push(this);

```

However, you need some way to figure out when to remove instances from this array, or you'll leak memory.
Sorry for such a late reply, but I found myself trying to achieve this and I think this may be a simpler answer.

Say you want all instances of class MyClass, only get instances created at top window level (not including instances created inside a closure):

```
for (var member in window)
{
    if (window[member] instanceof MyClass)
        console.info(member + " is instance of MyClass");
}

```