you should trigger the event on the appropriate element instead of triggering them on the document, so that you can attach your listener near the element you want to watch or use the jQuery event delegation instead of being forced to attached it on document and filter the undesirable elements manually (essentially duplicating the work done by the jQuery event delegation feature)