PawelDecowski/jQuery-CreditCardValidator — pull request #17 by geoffreylitt (2012-08-17 12:02:19+00:00)
Title: Validation should only run when selector is found

We're using this awesome script on a Rails site where all our JS is minified and loaded on all pages, including pages which don't display a credit card form. This was causing a JS error on those other pages because the validate function was being called on an empty jQuery object (since nothing on the page matched the selector for the credit card number input). I added a check to make sure the selector was actually matched on the page before running the validate function, to avoid this error.