Couldn't you have just used `$.contains`?