I suppose ``$('.filter')`` and ``$('form.filter')`` return the same set of objects, I suggest you put that in a variable and thus call it only once. And if as I think this returns only one object, I would suggest using an ID instead of a class, so you can be sure only one object will be returned. Especially since ``filter`` is such a generic name.